使用Nginx + FastCGI-Mono-Server4从ASP.Net 3.5迁移到4.0后出错

时间:2012-05-16 00:01:12

标签: asp.net .net-4.0 nginx fastcgi-mono-server

我正在使用Nginx + FastCGI-Mono-Server来托管一个小的asp.net Web服务。它使用FastCGI-Mono-Server2(即.Net 2.0版本)运行得很好。我现在需要将asp.net应用程序升级到.net 4.0。这意味着我需要升级到FastCGI-Mono-Server4。我把所有正确的文件放在适当的位置。有用!然而,它始终因一个神秘的错误而崩溃。

这是错误:

异常:System.Runtime.FatalException

消息:对象引用未设置为对象的实例。

StackTrace:在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)    在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)    在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)    在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)    在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)    在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)    在System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)    在System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext请求,Boolean cleanThread,OperationContext currentOperationContext)    在System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext请求,OperationContext currentOperationContext)    在System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult结果)    在System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult结果)    在System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult结果)    在System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)    at System.ServiceModel.Channels.FramingDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult result)    在System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult结果)    在System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)    at System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state)    在System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(对象状态)    在System.ServiceModel.Channels.SocketConnection.FinishRead()    在System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean hasResult,Int32 error,Int32 bytesRead)    在System.ServiceModel.Channels.OverlappedContext.CompleteCallback(UInt32错误,UInt32 numBytes,NativeOverlapped * nativeOverlapped)    在System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32错误,UInt32 bytesRead,NativeOverlapped * nativeOverlapped)    在System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode,UInt32 numBytes,NativeOverlapped * pOVERLAP)

InnerException:System.NullReferenceException

消息:对象引用未设置为对象的实例。

StackTrace:at System.Web.HttpApplication.ThreadContext.Enter(Boolean setImpersonationContext)    在System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)    在System.Web.AspNetSynchronizationContext.CallCallbackPossiblyUnderLock(SendOrPostCallback回调,对象状态)    在System.Web.AspNetSynchronizationContext.CallCallback(SendOrPostCallback回调,对象状态)    在System.Web.AspNetSynchronizationContext.Post(SendOrPostCallback回调,对象状态)    在System.ServiceModel.Dispatcher.ThreadBehavior.BindCore(MessageRpc& rpc,Boolean startOperation)    在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)

我在项目中有一个IHttpAsyncHandler。我想知道它是否与此有关。当我搜索我的错误时,我发现人们(像这样:wcf callback exception after updating to .net 4.0)推荐这个属性:

[CallbackBehavior(UseSynchronizationContext =假)]

据我所知,这是一个WCF,与我的asp.net Web服务器无关。 任何想法将不胜感激!

EV

1 个答案:

答案 0 :(得分:0)

运行

ln -s /opt/mono-3.2/lib/mono/4.0/fastcgi-mono-server4.exe /opt/mono-3.2/lib/mono/4.5/fastcgi-mono-server4.exe

使用4.5目录中的fastcgi服务器

/opt/mono-3.2/lib/mono/4.5/fastcgi-mono-server4.exe

如果Mono安装在其他位置,请将/opt/mono-3.2替换为单声道前缀