C# WCF服务生成的WSDL

C# WCF服务生成的WSDL,c#,web-services,wcf,wsdl,C#,Web Services,Wcf,Wsdl,我有一个使用VisualStudio创建的WCF服务。生成的WSDL有一个我不想要的部分,但我不知道它来自哪里 -<wsdl:service name="AdfsService"> -<wsdl:port name="CustomBinding_IAdfsService" binding="tns:CustomBinding_IAdfsService"> <soap12:address location="https://localhost/AdCustomerS

我有一个使用VisualStudio创建的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>
-
-
-
https://localhost/AdCustomerService/AdfsService.svc
我需要删除的是:

-<wsa10:EndpointReference>

<wsa10:Address>https://localhost/AdCustomerService/AdfsService.svc</wsa10:Address>

</wsa10:EndpointReference>
-
https://localhost/AdCustomerService/AdfsService.svc
这是我的网络配置:

    <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>

希望这能给您提供线索。

这是因为您的自定义配置, 根据我非常感兴趣的测试,假设我定义了如下端点:

<endpoint address="" binding="customBinding" bindingConfiguration="x" contract="interfaceContract">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>

希望这能为您提供线索。

您尝试过发布的解决方案吗?您尝试过发布的解决方案吗?删除绑定配置并将其他数据添加到wsa10:Endpointreference。我开始使用wsHttpBinding,但在customBinding中遇到了同样的问题。显示的解决方案均未完全删除wsa10:Endpointreference。是否确定?我再次测试了它,通过删除另一个端点配置,我在
wsdl
中看不到任何
EndPointReference
。在
web.config
中,我只有端点元素作为
wsdl
输出的绑定元素中没有
EndPointReference
。这是绑定类型。使用的wsHttpBinding生成endpointreference。我确实将其更改为basicHttpsbinding,因为我不想使用不安全的连接。非常感谢您的帮助。删除bindingconfiguration将为wsa10:Endpointreference添加更多数据。我开始使用wsHttpBinding,但在customBinding中遇到了同样的问题。显示的解决方案均未完全删除wsa10:Endpointreference。是否确定?我再次测试了它,通过删除另一个端点配置,我在
wsdl
中看不到任何
EndPointReference
。在
web.config
中,我只有端点元素作为
wsdl
输出的绑定元素中没有
EndPointReference
。这是绑定类型。使用的wsHttpBinding生成endpointreference。我确实将其更改为basicHttpsbinding,因为我不想使用不安全的连接。非常感谢你的帮助。
    <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>
<endpoint address="" binding="netTcpBinding" contract="interfaceContract">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="" binding="netNamedPipeBinding" contract="interfaceContract" />