0

在我们的测试服务器(Windows Server 2008 R2)上,我几乎没有可以正常工作的 WCF 服务。当我将这些服务移动到产品服务器时,服务返回 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)
4

2 回答 2

0

感谢大家的反馈。事实证明,在应用程序 adv 设置中将“启用 32 位应用程序”设置为 true 后解决了这个问题。

于 2013-09-12T17:47:26.960 回答
0

我认为这是它的关键:

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

ASP.NET 论坛上的一个主题处理了同样的问题。

这通常是客户端/服务器绑定中的不匹配,其中服务中的消息版本使用 SOAP 1.2(需要 application/soap+xml)而客户端中的版本使用 SOAP 1.1(发送 text/xml)。WSHttpBinding 使用 SOAP 1.2,BasicHttpBinding 使用 SOAP 1.1。尝试以下方法来检查它是否可以解决您的问题。

  1. 将 basicHttpBinding 更改为 wsHttpBinding
  2. 更改您的应用程序池以在网络服务下运行并为网络服务提供适当的权限。
于 2013-09-12T17:31:40.260 回答