我们有一个使用我们的WCF服务的旧主页。现在我们必须改变服务功能的一些东西,而不是接口。只在服务功能内!部署新服务后,主页无法获取服务功能。我比较了旧的和新的wsdl,并且有一些变化:
老wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="DataService"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:wsa10="http://www.w3.org/2005/08/addressing"
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
xmlns:i0="http://service.bizztools.de/services/dataservice"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:tns="http://tempuri.org/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
<wsp:Policy wsu:Id="WSHttpBinding_IDataService_policy">
<wsp:ExactlyOne>
<wsp:All>
<wsaw:UsingAddressing/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:import location="https://<server>/Service.svc?wsdl=wsdl0" namespace="http://service.bizztools.de/services/dataservice"/>
<wsdl:types/>
<wsdl:binding name="WSHttpBinding_IDataService" type="i0:IDataService">
<wsp:PolicyReference URI="#WSHttpBinding_IDataService_policy"/>
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetSalesPartnerData">
<soap12:operation style="document" soapAction="http://service.bizztools.de/services/dataservice/IDataService/GetSalesPartnerData"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
<wsdl:fault name="DataServiceDbErrorFault">
<soap12:fault name="DataServiceDbErrorFault" use="literal"/>
</wsdl:fault>
<wsdl:fault name="AuthenticationErrorFault">
<soap12:fault name="AuthenticationErrorFault" use="literal"/>
</wsdl:fault>
<wsdl:fault name="DataServiceFormatErrorFault">
<soap12:fault name="DataServiceFormatErrorFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="BasicHttpBinding_IDataService" type="i0:IDataService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetSalesPartnerData">
<soap:operation style="document" soapAction="http://service.bizztools.de/services/dataservice/IDataService/GetSalesPartnerData"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="DataServiceDbErrorFault">
<soap:fault name="DataServiceDbErrorFault" use="literal"/>
</wsdl:fault>
<wsdl:fault name="AuthenticationErrorFault">
<soap:fault name="AuthenticationErrorFault" use="literal"/>
</wsdl:fault>
<wsdl:fault name="DataServiceFormatErrorFault">
<soap:fault name="DataServiceFormatErrorFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DataService">
<wsdl:port name="WSHttpBinding_IDataService" binding="tns:WSHttpBinding_IDataService">
<soap12:address location="http://<server>/Service.svc/dataservice"/>
<wsa10:EndpointReference>
<wsa10:Address>http://<server>/Service.svc/dataservice</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
<wsdl:port name="BasicHttpBinding_IDataService" binding="tns:BasicHttpBinding_IDataService">
<soap:address location="http://<server>/Service.svc/dataservicebasic"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
新wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="DataService"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:wsa10="http://www.w3.org/2005/08/addressing"
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
xmlns:i0="http://service.bizztools.de/services/dataservice"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:tns="http://tempuri.org/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
<wsp:Policy wsu:Id="WSHttpBinding_IDataService_policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false"/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Strict/>
</wsp:Policy>
</sp:Layout>
</wsp:Policy>
</sp:TransportBinding>
<wsaw:UsingAddressing/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsp:Policy wsu:Id="BasicHttpBinding_IDataService_policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false"/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic256/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>+
<wsp:Policy>
</sp:Layout>
</wsp:Policy>
</sp:TransportBinding>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:import location="https://<server>/Service.svc?wsdl=wsdl0" namespace="http://service.bizztools.de/services/dataservice"/>
<wsdl:types/>
<wsdl:binding name="WSHttpBinding_IDataService" type="i0:IDataService">
<wsp:PolicyReference URI="#WSHttpBinding_IDataService_policy"/>
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetSalesPartnerData">
<soap12:operation style="document" soapAction="http://service.bizztools.de/services/dataservice/IDataService/GetSalesPartnerData"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
<wsdl:fault name="DataServiceDbErrorFault">
<soap12:fault name="DataServiceDbErrorFault" use="literal"/>
</wsdl:fault>
<wsdl:fault name="DataServiceFormatErrorFault">
<soap12:fault name="DataServiceFormatErrorFault" use="literal"/>
</wsdl:fault>
<wsdl:fault name="AuthenticationErrorFault">
<soap12:fault name="AuthenticationErrorFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="BasicHttpBinding_IDataService" type="i0:IDataService">
<wsp:PolicyReference URI="#BasicHttpBinding_IDataService_policy"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetSalesPartnerData">
<soap:operation style="document" soapAction="http://service.bizztools.de/services/dataservice/IDataService/GetSalesPartnerData"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="DataServiceDbErrorFault">
<soap:fault name="DataServiceDbErrorFault" use="literal"/>
</wsdl:fault>
<wsdl:fault name="DataServiceFormatErrorFault">
<soap:fault name="DataServiceFormatErrorFault" use="literal"/>
</wsdl:fault>
<wsdl:fault name="AuthenticationErrorFault">
<soap:fault name="AuthenticationErrorFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DataService">
<wsdl:port name="WSHttpBinding_IDataService" binding="tns:WSHttpBinding_IDataService">
<soap12:address location="https://<server>/Service.svc/dataservice"/>
<wsa10:EndpointReference>
<wsa10:Address>https://<server>/Service.svc/dataservice</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
<wsdl:port name="BasicHttpBinding_IDataService" binding="tns:BasicHttpBinding_IDataService">
<soap:address location="https://<server>/Service.svc/dataservicebasic"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
似乎问题是wsp:policy。为什么新wsdl这个政策和旧政策没有?如何更改wsdl。不幸的是,我们无法更改主页!
我使用Microsoft Visual Studio 2010来创建WCF服务。
答案 0 :(得分:0)
我自己发现了这个问题。它不是不同的wsdl。这是IIS上的AddressFiltering的一个问题。我收到错误消息:由于EndpointDispatcher上的AddressFilter不匹配,无法在接收方处理带有To 'http://<service>'
的消息。检查发件人和收件人的EndpointAddresses是否同意&#39; 。所以我在服务类上使用属性[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
修复了问题。