我的测试服务器(Windows Server 2008 R2)上运行的WCF服务很少。当我将这些服务移动到prod服务器时,服务返回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; 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)
答案 0 :(得分:0)
我认为这是关键:
内容类型application / soap + xml; charset = utf-8被发送到期望text / xml的服务;字符集= UTF-8。客户端和服务绑定可能不匹配。
A thread on the ASP.NET forums处理同样的问题。
这通常是客户端/服务器绑定不匹配的地方 服务中的消息版本使用SOAP 1.2(期望 application / soap + xml),客户端中的版本使用SOAP 1.1 (发送text / xml)。 WSHttpBinding使用SOAP 1.2,BasicHttpBinding 使用SOAP 1.1。请尝试以下方法检查是否可以重新获得 你的问题。
- 将basicHttpBinding更改为wsHttpBinding
- 将您的应用程序池更改为在网络服务下运行,并为网络服务提供适当的权限。
醇>
答案 1 :(得分:0)
感谢大家的反馈。事实证明,在应用程序adv设置中将“启用32位应用程序”设置为true后解决了此问题。