本地 IIS 上的 MVC 3 应用程序

发布于 2024-10-20 00:56:41 字数 2210 浏览 1 评论 0原文

我曾有过一些有趣的经历,将 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_DisplayClass123.b__11(TSource x) +32 System.Linq.WhereSelectEnumerableIterator2.MoveNext() +151 System.Linq.d__b11.MoveNext() +92 System.Linq.Enumerable.Single(IEnumerable1 来源)+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
x) +32
System.Linq.WhereSelectEnumerableIterator
2.MoveNext()
+151
System.Linq.d__b11.MoveNext()
+92
System.Linq.Enumerable.Single(IEnumerable
1
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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清引 2024-10-27 00:56:41

我认为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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文