【发布时间】:2020-02-07 03:24:52
【问题描述】:
我创建了一个简单的 REST 服务 (WCF),它将使用另一个 SOAP 服务。
我的 REST 服务工作正常,但是当我添加 SOAP 服务(作为服务参考添加)时,它会将数据添加到Web.config 文件。
我要强调的一件事是我不想公开 SOAP 服务,我只会使用它。
但是当我尝试调用一个操作时,我得到了这个错误:
www.myaddress.com 的端点没有与 无 消息版本。 'System.ServiceModel.Description.WebHttpBehavior' 仅适用于 WebHttpBinding 或类似的绑定。
在互联网上,人们对配置文件有疑问,但他们暴露了两个服务。我只是公开一项服务,并使用另一项服务。目前,我通过 localhost 使用的 REST 服务,而 SOAP 服务使用 SAML ADFS 身份验证
这是我的配置文件的样子,有人可以建议修复吗?
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2"/>
</system.web>
<system.serviceModel>
<bindings>
<ws2007FederationHttpBinding>
<binding name="WS2007FederationHttpBinding_mySOAPService">
<security mode="TransportWithMessageCredential">
<message>
<issuer address="issuer.address"/>
<issuerMetadata address="issuer.metadata.address" />
<tokenRequestParameters>
.
.
.
</tokenRequestParameters>
</message>
</security>
</binding>
</ws2007FederationHttpBinding>
<ws2007HttpBinding>
<binding name="binding.address">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" establishSecurityContext="false" />
</security>
</binding>
</ws2007HttpBinding>
</bindings>
<client>
<endpoint address="endpoint.address"
binding="ws2007FederationHttpBinding" bindingConfiguration="WS2007FederationHttpBinding_mySOAPService"
contract="ServiceReference1.mySOAPService" name="WS2007FederationHttpBinding_mySOAPService" />
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior>
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="webHttpBinding" scheme="http" />
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
【问题讨论】:
标签: c# asp.net rest web-services soap