Florian
Florian

Reputation: 1887

WCF and Windows Store apps, ConfigurationErrorsException

I am getting a "ConfigurationErrorsException" when I try to create a new Instance of the service.

Edit: My App and the WCF service are not on the same machine. The Wcf service is running on a Windows Server 2012.

My Code in the Windows Store app looks like this:

 var api = new ServiceRef.MyTestServiceClient(ApiServiceClient.EndpointConfiguration.BasicHttpEndpoint);

My WCF Configuration is (It's hosted as a windows service):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="MyTestService.MyTestService"
               behaviorConfiguration="MyTestServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8000/"/>
          </baseAddresses>
        </host>
        <endpoint address="" binding="basicHttpBinding"
          name="BasicHttpEndpoint"
          bindingConfiguration=""
          contract="MyTestService.IMyTestService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding"
           contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyTestServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="False"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

The complete error message is:

The type 'Microsoft.VisualStudio.Diagnostics.ServiceModelSink.Behavior, Microsoft.VisualStudio.Diagnostics.ServiceModelSink, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' registered for extension 'Microsoft.VisualStudio.Diagnostics.ServiceModelSink.Behavior' could not be loaded.

Upvotes: 1

Views: 1688

Answers (2)

Thomas Hetzer
Thomas Hetzer

Reputation: 1637

I had the same problem. The following steps have solved the problem for me:

  • Close Visual Studio
  • Delete the .suo and .csproj.user files
  • Restart Visual Studio
  • Rebuild the project

Upvotes: 2

user2471995
user2471995

Reputation: 1

It is probably because the referenced assembly is not part of the ".NET for Windows Store apps" library. According to this, http://msdn.microsoft.com/en-us/library/windows/apps/br230302(v=vs.110).aspx, diagnostics are not supported: "Types and members that wrap operating system functionality (such as System.Diagnostics.EventLog and performance counters)."

Upvotes: -1

Related Questions