【发布时间】:2020-06-01 13:14:13
【问题描述】:
WCF REST 服务的方法是使用 C# WCFClient 针对生产服务器。 他们还在本地主机上的开发环境中工作。 服务和 wsdl 也可以通过浏览器访问生产环境。
但是当我从 Production-Server 上的服务访问任何方法时,将返回 400 Bad Request。 IIS 日志也显示 400:GET /WCD/WCF.svc/GetNextGuestNumber - 443 - Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+ Chrome/83.0.4103.61+Safari/537.36 https://www.DS.XXX.com/qa/dLobby 400 0 0 46
这是我的生产环境的 web.config:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<add key="WBCCNN" value="PQkSAXkRXNsanbA5xK1KBZZqu+oxrJbssQlEiM1Fi+N2Vnz0F5QfAetqILb0QeLwlF7jMZ57k9J8sIlAJ1TRjtfgwh0V88Q2Kl/20Cny2WCTawWyDSECKg=="/>
</appSettings>
<system.web>
<compilation debug="false" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<services>
<service name="DS.XXX.Services.WCF" behaviorConfiguration="DSServiceBehavior">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="secureHttpBinding"
contract="DS.XXX.Services.IWCF"/>
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="secureHttpBinding">
<security mode="Transport">
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="DSServiceBehavior">
<serviceMetadata httpsGetEnabled="true" httpsGetUrl="" />
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
这些方法是从带有 Axios 的 REACT JS 应用程序调用的
const res = await API.get("/GetNextGuestNumber");
Axios 的 API 配置如下:
import axios from "axios";
import global from "../config";
export default axios.create({
baseURL: global.webServicesUrl,
headers: { "Content-Type": "application/json" }
});
由于服务在 dev 上运行,并且 svc 和 wsdl 在 prod 上是可访问的,所以它必须与绑定和端点配置有关?
我正在使用第三方供应商提供的证书,该证书也可以正常工作。 我没看到。任何帮助表示赞赏。如果您需要更多详细信息,请告诉我。
环境:Windows Server 2016、IIS
【问题讨论】:
标签: wcf axios wcf-binding