异常现象:
在Visual Studion下Service References中尝试Add Service,但是自动生成的Reference.cs是空的。App.config(Web.config)文件不会被更新,没有自动添加Service的配置信息。
解决办法:
大部分原因是因为WCF Service中有方法是用同类型的参数。不要勾选“重用引用程序集中的类型”)
参考地址:http://stackoverflow.com/questions/1408509/sometimes-adding-a-wcf-service-reference-generates-an-empty-reference-cs
Generally I find that it's a T4 codegen issue and most of the time it's because I've got a type name conflict it couldn't resolve.
If you right-click on your service reference and click configure and uncheck "Reuse Types in Referenced Assemblies" it'll likely resolve the issue.
If you were using some aspect of this feature, you might need to make sure your names are cleaned up.
另外:
可以用WCFTestClient来测试WCF Service是否是正常工作的。(在VS工具中打开Open Visual Studio Command Prompt,输入”WCFTestClient“)
本文由VS软件圈(vssoft.net)发布,不代表VS软件圈立场,转载联系作者并注明出处:https://vssoft.net/vsazwt/VS2010anzhuangwenti/2020/0724/2522.html