And*_*ndy 22 c# iis owin asp.net-mvc-5
Mvc 5似乎依赖于Owin,如果你想自己托管或在Mac上运行,那就太棒了.但是我们假设我只想在IIS下运行,就像以前的版本一样,我对Owin提供的东西不感兴趣.默认的"空白"mvc5模板使用owin和其他15个依赖项.我已经尝试逐个删除软件包,但似乎网站不知道如何在不使用Owin的属性的情况下启动.那么,如何在没有Owin的iis下获得ASP.net,mvc 5?
Moh*_*our 40
禁用Owin的简单方法是在web.config文件和<appSettings>部分中添加:
<add key="owin:AutomaticAppStartup" value="false" />
要完全删除Owin,请右键单击您的项目,然后单击菜单Manage Nuget Packages.在Manage Nuget Packages窗口左侧单击,Installed Package然后在搜索框类型的窗口右侧owin.
microsoft.owin.security.twitter删除自动删除的其他owin包后,如果您的机器上没有发生,请自行删除其他包.然后删除此包:
打开web.config文件并删除以下部分<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">:
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)
删除Startup.cs项目根目录中的文件.打开App_Start folder并删除IdentityConfig.cs和Startup.Auth.cs文件.打开Controller folder并删除AccountController.cs和ManageController.cs.在Models folder删除所有模型和View Folder删除Account Folder和Manage folder.
重新启动Visual Studio,然后运行该项目.如果你收到这个错误:
尝试加载应用程序时发生以下错误. - 找不到包含OwinStartupAttribute的程序集. - 找不到包含Startup或[AssemblyName] .Startup类的程序集.要禁用OWIN启动发现,请在web.config中添加值为"false"的appSetting owin:AutomaticAppStartup.要指定OWIN启动程序集,类或方法,请在web.config中添加appSetting owin:AppStartup以及完全限定的启动类或配置方法名称.你有两种解决方法:
bin folder,如果有Owin assembly,请删除所有这些<appSettings>部分中打开web.config 然后添加它<add key="owin:AutomaticAppStartup" value="false" />| 归档时间: |
|
| 查看次数: |
14171 次 |
| 最近记录: |