1

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.

4
  • If your App and WCF service are on the same machine, that could be part of the problem. See the explanation in my answer here: stackoverflow.com/questions/16783974/…
    – chue x
    Jun 8, 2013 at 23:01
  • this is not the case, as this was the first fix I tried
    – Florian
    Jun 9, 2013 at 10:19
  • Do you have any solution for this? I have the same exception now and cant solve it for hours... Jun 22, 2013 at 14:09
  • Not a real one, but in release i can press f5 and ignore it.
    – Florian
    Jun 24, 2013 at 8:33

2 Answers 2

2

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
-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)."

1
  • yeah maybe in vs, but how do I change this? Since this has nothing to do with my app, but with vs
    – Florian
    Jun 11, 2013 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.