Mvc 5 seems to depend on Owin, with is great if you want to self host or run on a Mac. But lets assume I just want to run under IIS just like the previous versions and I'm not interested in what Owin has to offer. The default "blank" mvc5 template uses owin and 15 other dependencies. I've tried removing packages one by one but it seems like the site didn't know how to start without using an attribute from Owin. So, how do I get just ASP.net, mvc 5, under iis without Owin?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
The default mvc5 template uses Identity as the membership system. Identity depends on Owin so that's the reason it's included in the project (with several other 'optional' packages). If you create a new empty project and install manually the package Microsoft.Aspnet.Mvc (with the command
Install-Package Microsoft.Aspnet.Mvc
) you can see there's no dependency on Owin.Obs: You could also create an Empty project with 'Add folders and core references for MVC' option checked.
I just specify the complete route and it works for me!!
The easy way to disable Owin is in
web.config
file and in<appSettings>
section add this:<add key="owin:AutomaticAppStartup" value="false" />
To remove Owin completely right click on your project and from menu click on
Manage Nuget Packages
. on left side ofManage Nuget Packages
window click onInstalled Package
then on right side of window in search box typeowin
.uninstall packages in order of:
and after removing
microsoft.owin.security.twitter
other owin packages removed automatically and if it does not happened on your machine remove the others by yourself. then remove this packages:Open
web.config
file and remove these sections from<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
:Remove
Startup.cs
file in root of the project. openApp_Start folder
and removeIdentityConfig.cs
andStartup.Auth.cs
files. openController folder
and removeAccountController.cs
andManageController.cs
. inModels folder
Delete all Models and inView Folder
RemoveAccount Folder
andManage folder
.Restarts Visual Studio and after that run the project. if you get this error:
bin folder
and if there is anyOwin assembly
, delete all of them<appSettings>
section then add this<add key="owin:AutomaticAppStartup" value="false" />
OWIN is just a standard, which decouples ASP.net apps from IIS, thus apps can be self hosted, among other benefits, but it doesnt mean that you cant host them in IIS.