错误:与SvcUtil工具端口:不能导入WSDL端口、错误、工具、WSDL

2023-09-06 22:58:41 作者:我爱你、你随意

我创建了一个小WCF服务(托管在IIS),并使用Chrome浏览器利用它的WSDL,把在一个.wsdf文件,然后想用 SvcUtil工具test.wsdl 生成客户端代理出来的,但我得到这个错误:

I created a small WCF service (hosted in IIS) and used Chrome to take the wsdl of it, put that in a .wsdf file and then wanted to use svcutil test.wsdl to generate the client proxy out of it but I'm getting this error:

错误:无法导入WSDL:端口   详细信息:时出错导入WSDL:绑定的WSDL:端口是依赖   耳鼻喉科的。   XPath来WSDL:绑定://wsdl:definitions[@targetNamespace='http://tempuri.org/   ] / WSDL:绑定[@名称='WSHttpBinding_IService1']   XPath来误差源://wsdl:definitions[@targetNamespace='http://tempuri.org/   ] / WSDL:服务[@名称='服务1'] / WSDL:端口[@名称='WSHttpBinding_IService1']

Error: Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is depend ent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://tempuri.org/' ]/wsdl:binding[@name='WSHttpBinding_IService1'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/' ]/wsdl:service[@name='Service1']/wsdl:port[@name='WSHttpBinding_IService1']

任何人都遇到了这一点,并找到了解决办法呢?

Anyone else encountered this and found a solution for it?

更新:所建议的约翰·桑德斯,感谢的是,它的工作原理时,我就直接指出来的网址。然而,这是我的小测试案例,看看有什么SvcUtil工具可以做的,因为我希望未来的日子里获得来自第三方WSDL文件,并可能会遇到同样的问题。当我采取了最简单的出产生的.svc箱子的我似乎并没有将其包含块。

Update: as suggested by John Saunders, thanks for that, it works when I point it out directly to the url. However this is my little test case to see what svcutil can do as I expect the coming days to get a wsdl file from a 3rd party and might run into the same problem. As I took the most simplistic out of the box generated .svc I don't seem to be having include blocks.

推荐答案

如果WSDL中有它包含块 - 他们经常这样做WCF所产生的时候 - 那你再有可能只保存'主'的WSDL文件,而不是所有引用的文件。

If the wsdl has Include blocks in it - and they often do when generated by WCF - then you're likely only saving the 'main' wsdl file and not all the referenced files.

这样做的结果是,在主文件将没有任何意义。正如约翰·桑德斯指出,尝试给URL以svcutil.exe的保存文件,而不是。

The result of this is that the main file won't make any sense. As John Saunders suggests, try giving the URL to svcutil.exe instead of saving the file.

 
精彩推荐
图片推荐