0
我正在用VS2013做一個ASP.NET MVC Web應用程序。本機Windows服務器企業,SP2和IIS 7ASP.NET/MVC:在上下文中找不到owin.Environment項
我得到了以下錯誤:
Server Error in '/' Application.
No owin.Environment item was found in the context.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: No owin.Environment item was found in the context.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: No owin.Environment item was found in the context.]
我用Google搜索,並找到了解決方案,並做了這樣的事情(加入<add name="OWIN".... >
)在web.config中:
<system.webServer>
<modules >
<remove name="FormsAuthenticationModule" />
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
<handlers>
<add name="OWIN" path="*" verb="*" type="Microsoft.Owin.Host.SystemWeb.OwinHttpHandler" />
</handlers>
</system.webServer>
這樣做後,網絡應用程序的作品。然而,所有的靜態文件,如CSS和Javascript都沒有被瀏覽器找到(所有這些靜態文件都是404),所以我的應用程序沒有風格。
什麼是配置
<handlers>
<add name="OWIN" path="*" verb="*" type="Microsoft.Owin.Host.SystemWeb.OwinHttpHandler" />
</handlers>
讓我的應用程序的工作權的正確方式?或者我需要做點別的?
謝謝!