本地 IIS 上的 MVC 3 应用程序
我曾有过一些有趣的经历,将 MVC3 应用程序部署到本地 IIS 服务器,但这一次很成功。从浏览器访问该网站时,我收到空引用异常。需要明确的是,该应用程序适用于 Cassini、IIS Express 和 IIS 7 (Win2008),但不适用于 IIS7.5 (Windows7)。
奇怪的是,当我将 VS2010 连接到 w3worker 进程时,该网站可以正常工作!那是多么奇怪啊。一旦我关闭 VS2010,它就会停止工作。
有人有什么建议吗?
这是错误:
[NullReferenceException:未将对象引用设置为实例
对象。] NLog.LogManager.GetCurrentClassLogger() +84 DynamicInjector2efc601a855d4eb08717697546358942(对象[] ) +40 Ninject.Activation.Providers.StandardProvider.Create(IContext 上下文)+335 Ninject.Activation.Context.Resolve() +177 Ninject.KernelBase.b_9(IContext 上下文)+8 System.Linq.<>c_DisplayClass12
3.
2.MoveNext() +151 System.Linq.d__b1b__11(TSource x) +32 System.Linq.WhereSelectEnumerableIterator 1.MoveNext() +92 System.Linq.Enumerable.Single(IEnumerable
1 来源)+196 Ninject.ResolutionExtensions.Get(IResolutionRoot 根,IParameter[] 参数)+151 Elvis.MvcApplication.get_Logger() +33 Elvis.MvcApplication.Application_Start() +126[HttpException (0x80004005): 对象引用未设置为
对象的实例。] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext 上下文,HttpApplication 应用程序)+9028953 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext、HttpContext 上下文、 MethodInfo[] 处理程序)+131 System.Web.HttpApplication.InitSpecial(HttpApplicationState 状态、MethodInfo[] 处理程序、IntPtr appContext、HttpContext 上下文)+194 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext、HttpContext 上下文)+339 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr 应用上下文)+253
[HttpException (0x80004005): 对象引用未设置为
对象的实例。] System.Web.HttpRuntime.FirstRequestInit(HttpContext 上下文)+8950644 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext 上下文)+97 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext 上下文)+256
I've had some interesting times deploying a MVC3 app to a localhost IIS server but this one cuts the cake. I am getting a null reference exception when hitting the site from a browser. To be clear, this application works on Cassini, IIS Express and IIS 7 (Win2008) but doesn't work on IIS7.5 (Windows7).
The weird thing is, is that when I attach VS2010 to w3worker process the site WORKS! How weird is that. Once I close out of VS2010 it stops working.
Anyone have any suggestions?
Here is the error:
[NullReferenceException: Object reference not set to an instance of an
object.]
NLog.LogManager.GetCurrentClassLogger()
+84
DynamicInjector2efc601a855d4eb08717697546358942(Object[]
) +40
Ninject.Activation.Providers.StandardProvider.Create(IContext
context) +335
Ninject.Activation.Context.Resolve()
+177
Ninject.KernelBase.b_9(IContext
context) +8
System.Linq.<>c_DisplayClass123.<CombineSelectors>b__11(TSource
2.MoveNext()
x) +32
System.Linq.WhereSelectEnumerableIterator
+151
System.Linq.d__b11.MoveNext()
1
+92
System.Linq.Enumerable.Single(IEnumerable
source) +196
Ninject.ResolutionExtensions.Get(IResolutionRoot
root, IParameter[] parameters) +151
Elvis.MvcApplication.get_Logger() +33
Elvis.MvcApplication.Application_Start()
+126[HttpException (0x80004005): Object reference not set to an
instance of an object.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext
context, HttpApplication app) +9028953
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
appContext, HttpContext context,
MethodInfo[] handlers) +131
System.Web.HttpApplication.InitSpecial(HttpApplicationState
state, MethodInfo[] handlers, IntPtr
appContext, HttpContext context) +194
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +339
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +253[HttpException (0x80004005): Object reference not set to an
instance of an object.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext
context) +8950644
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext
context) +97
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +256
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为NLog无法在中等信任级别运行,因此请确认您正在完全信任的环境中运行。更多信息可以在此处找到。
I think that NLog cannot be run at medium trustlevel, so please confirm that you are running in a full trust environment. More information can be found here.