WCF 服务生成的 WSDL
WCF Service Generated WSDL
我有一个使用 visual Studio 创建的 WCF 服务。生成的WSDL有一部分我不要,但不知道从哪里来的。
-<wsdl:service name="AdfsService">
-<wsdl:port name="CustomBinding_IAdfsService" binding="tns:CustomBinding_IAdfsService">
<soap12:address location="https://localhost/AdCustomerService/AdfsService.svc"/>
-<wsa10:EndpointReference>
<wsa10:Address>https://localhost/AdCustomerService/AdfsService.svc</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
</wsdl:service>
我需要删除的是:
-<wsa10:EndpointReference>
<wsa10:Address>https://localhost/AdCustomerService/AdfsService.svc</wsa10:Address>
</wsa10:EndpointReference>
这是我的网络配置:
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<customBinding>
<binding name="CustomTransportSecurity">
<transactionFlow />
<textMessageEncoding />
<httpsTransport />
</binding>
</customBinding>
</bindings>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false"/>
<services>
<service name="webservices.portalx.AdfsService">
<endpoint address="" contract="webservices.portalx.IAdfsService"
bindingNamespace="webservices.portalx" binding="customBinding"
bindingConfiguration ="CustomTransportSecurity"/>
<endpoint address="mex" contract="IMetadataExchange" binding="mexHttpsBinding"/>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking"/>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
preCondition="managedHandler"/>
</modules>
<directoryBrowse enabled="true"/>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
谁能指出我要寻找的方向?我尝试用谷歌搜索,但没有找到任何有用的链接。
那是因为你的自定义配置,
从我测试过的内容来看,我非常感兴趣,假设我这样定义和端点:
<endpoint address="" binding="customBinding" bindingConfiguration="x" contract="interfaceContract">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
然后定义自定义绑定如下:
<customBinding>
<binding name="x" openTimeout="00:00:10" >
<binaryMessageEncoding/>
<httpsTransport/>
</binding>
</customBinding>
托管服务后您会看到类似这样的内容:
<wsa10:EndpointReference>
<wsa10:Address>https://localhost:2061/PCM/Exam.svc</wsa10:Address>
<Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
<Dns>localhost</Dns>
</Identity>
</wsa10:EndpointReference>
另一方面,当我在没有自定义绑定的情况下这样定义端点服务时:
<endpoint address="" binding="basicHttpBinding" contract="MARCO.SOA.PCMServiceLib.IExamService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
基本绑定如:
<basicHttpBinding>
<binding allowCookies="true" openTimeout="00:00:10" maxReceivedMessageSize="2000000000" >
<readerQuotas maxDepth="32" maxArrayLength="2000000000" maxStringContentLength="2000000000" />
<security mode="None" />
</binding>
</basicHttpBinding>
wsdl
中没有EndPointReference
。
我认为当您定义 EndPoint
时,默认情况下 wsdl
中的 net.tcp
和 net.pipe
等协议有 EndPointRefrence
,例如:
<endpoint address="" binding="netTcpBinding" contract="interfaceContract">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="" binding="netNamedPipeBinding" contract="interfaceContract" />
希望这能给你线索。
我有一个使用 visual Studio 创建的 WCF 服务。生成的WSDL有一部分我不要,但不知道从哪里来的。
-<wsdl:service name="AdfsService">
-<wsdl:port name="CustomBinding_IAdfsService" binding="tns:CustomBinding_IAdfsService">
<soap12:address location="https://localhost/AdCustomerService/AdfsService.svc"/>
-<wsa10:EndpointReference>
<wsa10:Address>https://localhost/AdCustomerService/AdfsService.svc</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
</wsdl:service>
我需要删除的是:
-<wsa10:EndpointReference>
<wsa10:Address>https://localhost/AdCustomerService/AdfsService.svc</wsa10:Address>
</wsa10:EndpointReference>
这是我的网络配置:
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<customBinding>
<binding name="CustomTransportSecurity">
<transactionFlow />
<textMessageEncoding />
<httpsTransport />
</binding>
</customBinding>
</bindings>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false"/>
<services>
<service name="webservices.portalx.AdfsService">
<endpoint address="" contract="webservices.portalx.IAdfsService"
bindingNamespace="webservices.portalx" binding="customBinding"
bindingConfiguration ="CustomTransportSecurity"/>
<endpoint address="mex" contract="IMetadataExchange" binding="mexHttpsBinding"/>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking"/>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
preCondition="managedHandler"/>
</modules>
<directoryBrowse enabled="true"/>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
谁能指出我要寻找的方向?我尝试用谷歌搜索,但没有找到任何有用的链接。
那是因为你的自定义配置, 从我测试过的内容来看,我非常感兴趣,假设我这样定义和端点:
<endpoint address="" binding="customBinding" bindingConfiguration="x" contract="interfaceContract">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
然后定义自定义绑定如下:
<customBinding>
<binding name="x" openTimeout="00:00:10" >
<binaryMessageEncoding/>
<httpsTransport/>
</binding>
</customBinding>
托管服务后您会看到类似这样的内容:
<wsa10:EndpointReference>
<wsa10:Address>https://localhost:2061/PCM/Exam.svc</wsa10:Address>
<Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
<Dns>localhost</Dns>
</Identity>
</wsa10:EndpointReference>
另一方面,当我在没有自定义绑定的情况下这样定义端点服务时:
<endpoint address="" binding="basicHttpBinding" contract="MARCO.SOA.PCMServiceLib.IExamService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
基本绑定如:
<basicHttpBinding>
<binding allowCookies="true" openTimeout="00:00:10" maxReceivedMessageSize="2000000000" >
<readerQuotas maxDepth="32" maxArrayLength="2000000000" maxStringContentLength="2000000000" />
<security mode="None" />
</binding>
</basicHttpBinding>
wsdl
中没有EndPointReference
。
我认为当您定义 EndPoint
时,默认情况下 wsdl
中的 net.tcp
和 net.pipe
等协议有 EndPointRefrence
,例如:
<endpoint address="" binding="netTcpBinding" contract="interfaceContract">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="" binding="netNamedPipeBinding" contract="interfaceContract" />
希望这能给你线索。