我创建了两个WCF Web服务。第一个服务是返回JSON字符串的get服务,第二个服务是一个post服务,接受此JSON字符串作为Input并将这些数据存储在数据库中。
本地服务工作正常,但当我在服务器上传我的代码时,第一服务继续正常工作,但第二服务,即邮政服务,返回错误:
错误400错误请求。
据我所知,我在Web.config文件中遗漏了一些内容。
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<!--
<add name="Conn" connectionString="Data Source=*.*.*.*;Initial Catalog=*;User ID=*;Password=*" providerName="System.Data.SqlClient" />
<add name="connString" connectionString="Data Source=*.*.*.*;Initial Catalog=*;User ID=*;Password=*" providerName="System.Data.SqlClient" />
-->
<add name="Conn" connectionString="Data Source=*;Initial Catalog=SunshineDB;Integrated Security=True"/>
</connectionStrings>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="NetTcpBinding_IClaims"
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01:00"
transferMode="Buffered"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="16384"/>
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
<wsHttpBinding>
<binding name="wsBufferedHttpsBinding"
messageEncoding="Mtom"
maxReceivedMessageSize="11534336"
maxBufferPoolSize="524288"
sendTimeout="00:05:00"
receiveTimeout="00:05:00"
openTimeout="00:05:00"
closeTimeout="00:05:00" >
<readerQuotas maxDepth="64"
maxStringContentLength="11534336"
maxArrayLength="11534336"
maxBytesPerRead="11534336"
maxNameTableCharCount="16384" />
</binding>
</wsHttpBinding>
<customBinding>
<binding name="basicConfig">
<binaryMessageEncoding/>
<httpTransport transferMode="Streamed"
maxReceivedMessageSize="67108864"/>
</binding>
</customBinding>
</bindings>
<services>
<service name="SunShineServices.Service1">
<endpoint address=""
binding="webHttpBinding"
behaviorConfiguration="EndBehave"
contract="SunShineServices.ISunShineServices">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="EndBehave">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
答案 0 :(得分:0)
差异可能是安全设置,您在本地没有安全性,但服务器上没有Windows身份验证。
IE和NTLM的组合适用于http get,但是对http POST提出了错误的请求。