July 2007 - Posts

The configSource attribute was firstly introduced in .NET framework 2.0 to support external configuration files.

This attribute can be added to any configuration section to specify a an external file for that section. Using an external configuration source can be useful in many scenarios. For instance, you could place a section into an external configSource if you need an easy method to swap settings for the section depending on the environment (development, test, or production), or  you need granular control over permissions.

Unfortunately, the system.serviceModel section group does not support this attribute. If you try to add it, you will receive the following exception:

The attribute 'configSource' cannot be specified because its name starts with the reserved prefix 'config' or 'lock'

What I found out is that you can use this attribute on the different sections under system.serviceModel such as services, behaviors or bindings.

For instance, the configuration file could look like this,




    <services configSource="Services.config" >



    <bindings configSource="Bindings.config">



    <behaviors configSource="Behaviors.config">






 And then, each file contains the corresponding section.



  <service name="Microsoft.ServiceModel.Samples.CalculatorService"




        <add baseAddress="http://localhost:8000/servicemodelsamples/service"/>



    <!-- this endpoint is exposed at: net.tcp://localhost:9000/servicemodelsamples/service  -->

    <endpoint address="net.tcp://localhost:9000/servicemodelsamples/service"



              contract="Microsoft.ServiceModel.Samples.ICalculator" />

    <!-- the mex endpoint is exposed at http://localhost:8000/ServiceModelSamples/service/mex -->

    <endpoint address="mex"


              contract="IMetadataExchange" />






    <binding name="Binding1"














      <readerQuotas maxDepth="32"




                    maxNameTableCharCount="16384" />

      <reliableSession ordered="true"


                      enabled="false" />

      <security mode="Transport">

        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />








    <behavior name="CalculatorServiceBehavior">

      <serviceMetadata httpGetEnabled="true" />

      <serviceDebug includeExceptionDetailInFaults="False" />




Posted by cibrax | 8 comment(s)
Filed under: ,

If you haven't taken a look yet, Microsoft SharedView is a fast and easy way to share documents and screen views with small groups of friends or coworkers; anytime, anywhere, and what is most important, it is completely free. This version is available up to 15 people in different locations.

Although it is still in beta version, I have been using this product for a while to show the progress of my work to other off-site teams, and it works pretty well with a standard internet connection.

If you want to try it, it is available here.

A nice thing about the management layer in WCF is the WMI support to expose instrumentation at runtime with a well-know interface. That instrumentation includes different service characteristics such as contracts, services, behaviors, listeners or application hosts, which can be accessed by different management tools.

The built-in provider can be activated in the configuration file of the application through the "wmiProviderEnabled" attribute in the diagnostics element, as it is shown below,


    <diagnostics wmiProviderEnabled="true">


      <messageLogging logEntireMessage="false" logMalformedMessages="false" logMessagesAtTransportLevel="false" logMessagesAtServiceLevel="false"/>




Of course, this can be also be done through the SvcConfigEditor tool, which is the way I usually use for simplicity.

Once the WMI provider is enabled, and the service host is running, we will able to use a tool like WMI Object Browser to see the published information.

As is shown in the image above, if we browse to the objects in the namespace "root\ServiceModel", we will able to see an AppDomainInfo object with information about the WCF settings, and the service endpoints as well.

Also we can change some of those settings at runtime (These changes will not be saved in the configuration), for instance, to enable message logging, which can be ideal to detect sporadic problems on a specific server.

Other settings like Performance counters can also be enabled through this WMI model, but it requires some programming since it can not easily done with tools like this one.

And finally, Powershell scripts can also be used to query information about the objects published by the built-in WMI provider.

PS C:\Users\pci> get-wmiobject -class "AppDomainInfo" -namespace "root\servicemodel" -computername "."

__GENUS : 2
__CLASS : AppDomainInfo
__DYNASTY : AppDomainInfo
__RELPATH : AppDomainInfo.AppDomainId=2,Name="b576ed9b-1-128279485591533267",ProcessId=2184
__NAMESPACE : root\servicemodel
__PATH : \\PCI-MOBILE\root\servicemodel:AppDomainInfo.AppDomainId=2,Name="b576ed9b-1-128279485591
AppDomainId : 2
IsDefault : False
LogMalformedMessages : False
LogMessagesAtServiceLevel : False
LogMessagesAtTransportLevel : False
MessageLoggingTraceListeners :
Name : b576ed9b-1-128279485591533267
PerformanceCounters : Off
ProcessId : 2184
ServiceConfigPath : C:\Projects\Service WMI\service\web.config
ServiceModelTraceListeners : {xml}
TraceLevel : Information


Posted by cibrax | 4 comment(s)
Filed under: ,
More Posts