C# WCF服务返回空值

C# WCF服务返回空值,c#,wcf,C#,Wcf,我有几个WCF服务可以在我们的测试服务器(WindowsServer2008R2)上正常工作。当我将这些服务移动到prod server时,服务返回null。我不确定这是什么原因造成的。我猜生产服务器上缺少了一些东西,但不确定是什么。下面是异常日志。感谢您的反馈。谢谢 <E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"> <System xmlns="http://schemas

我有几个WCF服务可以在我们的测试服务器(WindowsServer2008R2)上正常工作。当我将这些服务移动到prod server时,服务返回null。我不确定这是什么原因造成的。我猜生产服务器上缺少了一些东西,但不确定是什么。下面是异常日志。感谢您的反馈。谢谢

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
  <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
    <EventID>131075</EventID>
    <Type>3</Type>
    <SubType Name="Error">0</SubType>
    <Level>2</Level>
    <TimeCreated SystemTime="2013-09-12T16:19:39.2467613Z" />
    <Source Name="System.ServiceModel" />
    <Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" />
    <Execution ProcessName="w3wp" ProcessID="4332" ThreadID="8" />
    <Channel />
    <Computer>CGWAPP268PD</Computer>
  </System>
  <ApplicationData>
    <TraceData>
      <DataItem>
        <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
          <TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
          <Description>Throwing an exception.</Description>
          <AppDomain>/LM/W3SVC/1/ROOT/HEIGISDataSvc-1-130234759301892473</AppDomain>
          <Exception>
            <ExceptionType>System.ServiceModel.ProtocolException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
            <Message>Content Type application/soap+xml; charset=utf-8 was sent to a service expecting text/xml; charset=utf-8.  The client and service bindings may be mismatched.</Message>
            <StackTrace>   at System.ServiceModel.Channels.HttpInput.ThrowHttpProtocolException(String message, HttpStatusCode statusCode, String statusDescription)
   at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception&amp;amp; requestException)
   at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
   at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
   at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

131075
3.
0
2.
CGWAPP268PD
http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx
正在引发异常。
/LM/W3SVC/1/ROOT/HEIGISDataSvc-1-130234759301892473
System.ServiceModel.ProtocolException,System.ServiceModel,版本=4.0.0.0,区域性=中性,PublicKeyToken=b77a5c561934e089
内容类型应用程序/soap+xml;charset=utf-8已发送到需要text/xml的服务;字符集=utf-8。客户端和服务绑定可能不匹配。
位于System.ServiceModel.Channels.HttpInput.ThrowHttpProtocolException(字符串消息、HttpStatusCode状态代码、字符串状态描述)
位于System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(异常和请求异常)
位于System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext上下文,操作回调)
位于System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult结果)
在System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandlerRequest()中
在System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()中
位于System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(对象状态)
在System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32错误代码,UInt32个字节,NativeOverlapped*NativeOverlapped)
在System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32错误,UInt32字节读取,NativeOverlapped*NativeOverlapped)
在System.Threading.\u IOCompletionCallback.PerformiCompletionCallback(UInt32错误代码,UInt32个字节,本机重叠*pOVERLAP)

我认为这是关键:

内容类型应用程序/soap+xml;charset=utf-8已发送到需要text/xml的服务;字符集=utf-8。客户端和服务绑定可能不匹配

处理同样的问题

这通常是客户机/服务器绑定中的不匹配,其中 服务中的消息版本使用SOAP 1.2(期望 应用程序/soap+xml),客户端中的版本使用soap 1.1 (它发送text/xml)。WSHttpBinding使用SOAP 1.2,BasicHttpBinding 使用SOAP 1.1。尝试以下方法来检查它是否可以重新启动 你的问题

  • 将basicHttpBinding更改为wsHttpBinding
  • 将应用程序池更改为在网络服务下运行,并为网络服务授予适当的权限

  • 谢谢大家的反馈。事实证明,在application adv中将“Enable 32-bit Applications”(启用32位应用程序)设置为true后,设置解决了此问题

    那么,客户端和服务的绑定是否不匹配?(参考内容类型application/soap+xml;charset=utf-8已发送到需要text/xml的服务;charset=utf-8。客户端和服务绑定可能不匹配。)打开客户端,转到web引用并更新引用。告诉我这是否解决了您的问题。]