WCF reference.cs suddenly not including classes

为君一笑 提交于 2021-01-27 07:40:25

问题


I have developed a WCF service that has been working fine for a few weeks now. I publish this service to IIS directly from the development server. I have a dev test app that includes this WCF service as a Service Reference in its own project.

My WCF class library also references another project within the Visual Studio solution, and many classes are in the referenced project that are used by the service and calling applications.

Today, after publishing some changes to the service (I did not make ANY changes to the referenced project or its classes), three of about 20 of the classes in the referenced project are no longer in the service reference of my test app. I cannot use them in code any longer, and they are no longer in the Reference.cs. I double checked, the classes in question are still decorated with [DataContract] and the properties are all still decorated with [DataMember] in the service solution.

Everything is building in Visual Studio OK.. I have rebuilt and republished everything, the missing classes are set to compile, I have tried IIS resets, completely deleted the IIS site and did a clean republish, no avail. I have tried deleting the service reference on the test app and getting a clean proxy every time as well. Nothing is working.

I then tried making a dummy class in the referenced project and built it in. Republished the service again, and even this dummy class does not appear in the Reference.cs. I am at a complete loss as to why these classes are not included in the .dll for the referenced project after it is published as it is evident that everything is building OK in Visual Studio.


回答1:


I face such problem. Following steps help you 1. Right click on Service ( In Service Reference Section of Project) 2. In Update Service Reference click on Advanced 3. Do as attached image.enter image description here




回答2:


Wanted to come back and post what was causing my problem:

I had made changes and none of my service methods used the 3 "missing" classes as a return type or parameter anymore. I simply had to un-comment the methods that used those classes to make them usable again. Makes sense now but I was convinced something else was wrong.




回答3:


I faced similar issue and resolved it by doing the following.

Add the address of your end point with mexHttpsBinding. E.g., Lets consider the address as mex.

While configuring service reference append /mex at the end of your service URL.

https://service.domain.com/serivce1.svc/mex

This will enable metadata exchange. So Reference.cs will be modified / added (if you are adding service reference for the first time).

Please Make sure that your service has an end point with mexHttpBinding / mexHttpsBinding

Edit : On analysis I found that this issue happens when the service is exposed via more than two end points (including mex end point)



来源:https://stackoverflow.com/questions/8542514/wcf-reference-cs-suddenly-not-including-classes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!