Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何配置svcutil生成的代码,以便它重新生成正确的WSDL?_.net_Wsdl_Svcutil.exe - Fatal编程技术网

.net 如何配置svcutil生成的代码,以便它重新生成正确的WSDL?

.net 如何配置svcutil生成的代码,以便它重新生成正确的WSDL?,.net,wsdl,svcutil.exe,.net,Wsdl,Svcutil.exe,我正试图从现有的WSDL中使用svcutil生成一个.NETSOAPWeb服务。WSDL包含以下信息: <types> <xsd:schema> <!-- ... --> <xsd:complexType name="DoStuffType"> <xsd:sequence> <xsd:element name="..." type="..." /> </xsd:sequence> </xsd

我正试图从现有的WSDL中使用svcutil生成一个.NETSOAPWeb服务。WSDL包含以下信息:

<types>
<xsd:schema>
<!-- ... -->
<xsd:complexType name="DoStuffType">
  <xsd:sequence>
    <xsd:element name="..." type="..." />
  </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DoStuffResponseType">
  <xsd:sequence>
    <xsd:element name="..." type="..." />
  </xsd:sequence>
</xsd:complexType>
<xsd:element name="DoStuff" type="tns:DoStuffType" />
<xsd:element name="DoStuffResponse" type="tns:DoStuffResponseType" />
</xsd:schema>
</types>

<message name="DoStuffSoapIn">
  <part name="messagePart" element="tns:DoStuff" />
</message>
<message name="DoStuffSoapOut">
  <part name="messagePart" element="tns:DoStuffResponse" />
</message>

<portType name="ASoapService">
  <operation name="DoStuff">
    <input message="tns:DoStuffSoapIn" />
    <output message="tns:DoStuffSoapOut" />
  </operation>
</portType>
如果随后从响应代码中删除[MessageContractSwrapped=false]属性,则会出现以下错误:

System.InvalidOperationException: The operation 'DoStuff' could not be loaded 
  because it has a parameter or return type of type 
  System.ServiceModel.Channels.Message or a type that has 
  MessageContractAttribute and other parameters of different types. When using 
  System.ServiceModel.Channels.Message or types with MessageContractAttribute, 
  the method must not use any other types of parameters.
另外,从请求代码中删除[MessageContractSwrapped=false]属性可以消除所有错误,但毫不奇怪,这可能会导致请求需要使用元素包装


我需要对生成的代码做什么才能让它重新生成正确的WSDL?

根据解决方案的答案是删除ReplyAction=*部分,但保留OperationContract属性。

仔细查看您的名称空间。看起来您引用了错误的名称空间。这当然是第一个错误所暗示的,但我看不出代码中有任何错误。没有明确提到http://schemas.datacontract.org. 思想?
System.InvalidOperationException: The operation 'DoStuff' could not be loaded 
  because it has a parameter or return type of type 
  System.ServiceModel.Channels.Message or a type that has 
  MessageContractAttribute and other parameters of different types. When using 
  System.ServiceModel.Channels.Message or types with MessageContractAttribute, 
  the method must not use any other types of parameters.