【问题标题】:Asp.NET Core 2.2 WCF Warning: PolicyAsp.NET Core 2.2 WCF 警告:策略
【发布时间】:2020-06-15 14:59:51
【问题描述】:

我正在尝试使用 WCF 添加 wsdl。但起初我收到这样的警告; enter image description here

详情如下:

未导入以下策略声明:

XPath://wsdl:definitions[@targetNamespace='urn:sap-com:document:sap:soap:functions:mc-style']/wsdl:binding[@name='zz_binding_SOAP12']

断言:

<saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd='http://www.sap.com/webas/710/soap/features/transportbinding/'>..</saptrnbnd:OptimizedXMLTransfer>
<sapattahnd:Enabled xmlns:sapattahnd='http://www.sap.com/710/features/attachment/'>..</sapattahnd:Enabled>

未导入以下策略声明:

XPath://wsdl:definitions[@targetNamespace='urn:sap-com:document:sap:soap:functions:mc-style']/wsdl:binding[@name='zz_binding']

断言:

    <saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd='http://www.sap.com/webas/710/soap/features/transportbinding/'>..</saptrnbnd:OptimizedXMLTransfer>
    <sapattahnd:Enabled xmlns:sapattahnd='http://www.sap.com/710/features/attachment/'>..</sapattahnd:Enabled>

未处理来自命名空间“http://schemas.xmlsoap.org/ws/2004/09/policy”的可选 WSDL 扩展元素“策略”。

XPath: //wsdl:definitions[@targetNamespace='urn:sap-com:document:sap:soap:functions:mc-style']/wsdl:portType[@name='zz_test_web_structure']/wsdl:operation[@name='ZzTestWebService']

未处理来自命名空间“http://schemas.xmlsoap.org/ws/2004/09/policy”的可选 WSDL 扩展元素“策略”。

XPath: //wsdl:definitions[@targetNamespace='urn:sap-com:document:sap:soap:functions:mc-style']/wsdl:portType[@name='zz_test_web_structure']

添加wcf服务后还是无法运行。有人知道吗?

【问题讨论】:

    标签: wcf asp.net-core policy service-reference


    【解决方案1】:

    Microsoft WCF Web Service Reference Provider 工具基于Mex 服务端点,即元数据交换服务端点而不是Web service definition language(WSDL 页面)。

      <services>
          <service name="WcfService1.Service1">
            <endpoint address="" binding="basicHttpBinding" contract="WcfService1.IService1" bindingConfiguration="mybinding"></endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
          </service>
    </services>
    

    或者,

    Binding mexbinding = MetadataExchangeBindings.CreateMexHttpBinding();
                    sh.AddServiceEndpoint(typeof(IMetadataExchange), mexbinding, "mex");
    

    如果您更喜欢使用 WSDL 生成客户端代理类,可以尝试使用 SVCUtil.exe 工具。
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/servicemodel-metadata-utility-tool-svcutil-exe
    以上所有方式都可以生成客户端代理类。
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/accessing-services-using-a-wcf-client
    此外,在 WCF4.5 中还有一个名为SingleWSDL 的新特性,它包含整个 WSDL 和相关架构。它完全可以被第三方系统使用。
    What is the difference between ?wsdl and ?singleWsdl parameters
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/whats-new
    如果有什么我可以帮忙的,请随时告诉我。

    【讨论】:

      猜你喜欢
      • 2020-01-21
      • 2020-01-12
      • 2019-09-24
      • 2019-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-09
      相关资源
      最近更新 更多