且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 VS2012 中添加 Web 服务引用时出错

更新时间:2022-12-23 21:18:27

我发现导致这种情况的一个可能原因是 VS2012 在允许访问 wsdl 之前尝试对安全代理进行身份验证.

I found that one possible reason that could be causing this was VS2012 trying to authenticate to the security proxy before it was allowed to get access to the wsdl.

>

为了解决这个问题,我开始使用命令行 wsdl.exe 工具来生成 Web 服务数据类型.之后我就没有再犯错误了.

To get around it, I started using the command line wsdl.exe tool to generate the web service data types. After that I did not have any more errors.

对于 .Net 4.0,它可以在C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\wsdl.exe"中找到

For .Net 4.0 it can be found at ""C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\wsdl.exe"

使用它从 wsdl 文件自动生成类型的示例:

example of using it to auto generate types from a wsdl file:

wsdl/l:CS YourWebservice.wsdl/pu:username/pp:password/pd:yourFirmDomain.com Common.xsd xmlmime.xsd

wsdl /l:CS YourWebservice.wsdl /pu:username /pp:password /pd:yourFirmDomain.com Common.xsd xmlmime.xsd