Search code examples
wcfasp.net-mvc-4c#-4.0service-reference

Incorrect WCF Service Reference / Empty Reference.cs file


I have created a WCF service using Service Library template. Using the Service.dll generated, I have hosted the service in a console application.

However, when I add a Service Reference in my web project, on viewing the Service details in Object browser, it points to incorrect assembly in the object browser as shown in the screen shot below.

enter image description here

enter image description here

One possible issue could be that, while renaming the namespaces in my web project, I ended up renaming the namespace of Service project also. But even after fixing all the namespaces, I still have this issue.

Any ideas on what can be done to resolve it?

While adding a Service Reference, it displays the correct members/interfaces as shown in the screenshot below. Only when I view the Service Reference in the object browser, I don't see those interfaces exposed by the service.

enter image description here

Project dependencies of service project

Not sure why the web project is a dependency of the Service library project? It should not be as I have not added any reference to it in the Service project.

enter image description here


Solution

  • I came across this question here after researching on this issue.

    I also found out that the reference.cs file was empty in my case also. After unchecking Reuse types in referenced assemblies from 'Configure Service Reference' dialog, I was able to generate the Service reference client code successfully. My Service reference is now pointing to the correct Interface/members. In case of any queries, feel free to comment or contact me directly.