0

I have a WCF service that is running fine on our old IIS server. This service has both methods and Classes it exposes, all set up properly using [ServiceContract], [OperationContract], and [DataContract]. The service works fine on the old server. The service is only visible on our local intranet.

We are trying to move to a new IIS server. Other ASP.NET web sites work on the new IIS server. Now, in the client app code, if I try to "Add Service Reference" I am able to successfully add a service reference to the new IIS server. The problem is that while the methods work, the Classes from the WCF service are not visible on the client app. If I take an existing service reference and in the app.config file if I change the url to the new server, everything works. I looked at the WSDL files and both have the Classes in them.

I have checked the "Roles and Features" on both servers and do not see any difference in the relevant items. What am I doing wrong?

Alex
  • 43
  • 4
  • https://stackoverflow.com/questions/3000209/service-reference-not-generating-client-types – Lex Li Jan 10 '20 at 02:57
  • Can you elaborate on the issue? I am confused about your problem. If you add the service reference by using the old IIS web server. Does it work properly(some classes are visible)? I suspect the WCF service is a Restful style, by default the client will generate nothing when adding service reference. I don’t know whether it is your issue. Please elaborate on the problem. – Abraham Qian Jan 10 '20 at 06:21

1 Answers1

0

Ok so the link provided in the comment above actually solved it. Thanks Lex Li

stackoverflow.com/questions/3000209/service-reference-not-generating-client-types

when I took Abraham Qian's suggestion and tried to add a new service reference to the old server, it was doing the same thing as the new server, not showing the classes. This told me it was a visual studio issue. I then tried Lex Li's suggestion and that solved my issue. As a short recap of the fix:

  1. When you add a new service reference, go to "Advanced..."
  2. By default, "Reuse types in all referenced assemblies" is selected. Change this to "Reuse types in specified referenced assemblies"
  3. In the box below that option, check "mscorlib".
  4. Finish adding the service reference as usual.

Once I did this, it fixed my issues. Thanks for everyone's help!

Alex
  • 43
  • 4