tags:

views:

1003

answers:

2

I have a super-simple WCF Service. I host it on my local machine using IIS7.

When I add a service reference to my service, Visual Studio tells me there was an error. I can click a Details link, and that bring up a dialog box saying: Object reference not set to an instance of an object.

I can build my WCF service with no problems, and my client app also builds successfully.

I can even use svcutil http://localhost/logservice/logservice.svc?wsdl to generate a client.

I've seen this error in my Windows Event Log/Viewer:

.NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (706B7706) (80131506)

I found a hotfix online, but that won't install...

I think this has something to do with the client solution from where I add the service reference. I can add a service refenrece using the the "Discover services in solution" function. I just need to add a service reference in a solution elsewhere, so this is driving me nuts.

My system.serviceModel of web.config looks as follows:

  <system.serviceModel>
<services>
  <service behaviorConfiguration="LogServiceBehavior" name="LogService">
    <endpoint address="" binding="wsHttpBinding" contract="ILogService">
      <identity>
     <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="LogServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

A: 

I've tried isolating the problem, away from my current solutions and into a new solution with absolutely no complexity.

  1. Create a new Web Site in Visual Studio from the WCF Service template.
  2. Add a C# 3.5 Class Library project to the solution.
  3. Build Solution.
  4. Add Service Reference on ClassLibrary1 project, and click the discover button to discover the WcfService1 inside this solution.
  5. You will see WcfService1 on the list, but when you click OK, or try expanding the service discovered, you will get the error. Sometimes VS2008 exits - without any prompt what so ever.

I've tried running C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>ServiceModelReg.exe -r which doesn't help.

Has anyone encountered anything like this?

MartinHN
A: 

Did you try to use known dlls to create the types?

codemeit