.net WCF WSDL在一个环境中有xsd:import语句,但在另一个环境中没有
在我们的INT和QA环境中,简单WCF服务的WSDL如下所示:.net WCF WSDL在一个环境中有xsd:import语句,但在另一个环境中没有,.net,wcf,wsdl,.net,Wcf,Wsdl,在我们的INT和QA环境中,简单WCF服务的WSDL如下所示: <wsdl:types> <xsd:schema targetNamespace="http://blahService/Imports"> <xsd:import schemaLocation="http://server:80/blahService/blahService.svc?xsd=xsd2" namespace="http://genericHeader"/> &
<wsdl:types>
<xsd:schema targetNamespace="http://blahService/Imports">
<xsd:import schemaLocation="http://server:80/blahService/blahService.svc?xsd=xsd2" namespace="http://genericHeader"/>
<xsd:import schemaLocation="http://server:80/blahService/blahService.svc?xsd=xsd3" namespace="http://blahServiceNamespace"/>
</xsd:schema>
</wsdl:types>
<wsdl:types>
<xsd:schema targetNamespace="http://blahService/Imports" />
</wsdl:types>
但在prod中,它看起来是这样的:
<wsdl:types>
<xsd:schema targetNamespace="http://blahService/Imports">
<xsd:import schemaLocation="http://server:80/blahService/blahService.svc?xsd=xsd2" namespace="http://genericHeader"/>
<xsd:import schemaLocation="http://server:80/blahService/blahService.svc?xsd=xsd3" namespace="http://blahServiceNamespace"/>
</xsd:schema>
</wsdl:types>
<wsdl:types>
<xsd:schema targetNamespace="http://blahService/Imports" />
</wsdl:types>
我读过很多关于将WCF生成的WSDL扁平化以直接在WSDL中包含XSD的帖子,甚至更多关于如何使schemaLocation指向特定URL而不是请求来自的URL的帖子,但我想知道的是。。。为什么WSDL在两种不同的环境中不同,我们如何修复它?WSDL是由WCF动态生成的。检查mex端点是否在PROD中公开
作为一个警告,要小心扁平化WSDL以消除导入。根据DTO对象图的复杂程度,XSD可能会由于交叉引用而“损坏”。在这种情况下,.NET工具可以很好地创建代理类,但我们已经体验到Java工具和其他XML验证工具由于模式错误而失败。INT/QA/PROD环境的web.configs都是一样的。它们都包括以下行:
尝试将整个INT/QA服务原样复制到PROD框中,并在IIS中将其设置为其他端口上的新服务。AppPool是否设置为以4.0运行?如果您使用针对“工作”WSDL生成的代理调用服务,是否会出现异常?这将需要更多的诊断,因为WSDL实际上不应该有所不同。看起来prod正在公开不同的服务。还有其他区别吗?您可以从生产中公开的WSDL创建工作代理吗?您正在公开SOAP服务吗?
[XmlSerializerFormat]
public partial interface IInterface
{ [OperationContract]
Response test(test[] tests);
}