简体   繁体   English

在具有多个应用程序池的iis服务器的根目录上运行C#MVC应用程序

[英]Running C# MVC application at root of iis server with multiple application pools

I am having a problem with a site I am trying to prototype for my organization. 我正在尝试为我的组织制作原型的网站出现问题。 I am building a C# MVC site that will eventually be the front-end for all of our sites. 我正在构建一个C#MVC网站,该网站最终将成为我们所有网站的前端。 When I deploy it to the root of the server, it cuts off access to all our sub-sites that also run on MVC. 当我将其部署到服务器的根目录时,它将切断对同样在MVC上运行的所有子站点的访问。 Our classic ASP sites work, but I think that's be cause the MVC routing engine can't handle those archaic sites anyway. 我们经典的ASP网站可以正常工作,但是我认为这是因为MVC路由引擎仍然无法处理那些过时的网站。

So, here's the layout of our application pool: 因此,这是我们的应用程序池的布局:

  • root site (currently classic asp) 根站点(当前为经典ASP)
  • sub-sites that have their own resource pools 拥有自己的资源池的子站点

I want to run my site at the root, and still be able to have the other applications run independently while they are upgraded/integrated with the root site. 我想在根目录上运行我的站点,并且在将其他应用程序与根站点进行升级/集成时,仍然能够使其他应用程序独立运行。

When I try to access any sub-application directly, I get a 401.2 access denied error. 当我尝试直接访问任何子应用程序时,出现401.2访问被拒绝错误。 I have tried adding the sub-applications to a routes.IgnoreRoutes statement, and straight up adding a route for the sub-application. 我尝试将子应用程序添加到route.IgnoreRoutes语句,并直接为子应用程序添加路由。

Can anyone help me figure out if I can do this, and what I would need to do to make this work? 谁能帮助我弄清楚我是否可以做到这一点,以及我需要做些什么才能使它起作用? Do all the sub-applications have to be a part of the same project? 所有子应用程序都必须属于同一项目吗? Any help/guidance you could provide would be immensely appreciated. 您能提供的任何帮助/指导将不胜感激。

Edit:. 编辑:。 All of the applications fall under one "site." 所有应用程序都属于一个“站点”。 Ourdomain.com/applications. Ourdomain.com/applications。 I want mine to run at ourdomain.com, and still be able to run all of the applications. 我希望我的程序可以在ourdomain.com上运行,并且仍然能够运行所有应用程序。

Ok. 好。 I figured it out. 我想到了。 I had to remove a bunch of stuff from the web.config that I deployed to the root of the site. 我必须从部署到网站根目录的web.config中删除一堆东西。 Bearing in mind that I have to deploy a pre-compiled application, here's what I removed: 请记住,我必须部署一个预编译的应用程序,这是我删除的内容:

<configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
</entityFramework>

Something else I had to do since our site uses active directory authentication is add the following to authorization: 由于我们的站点使用活动目录身份验证,因此我不得不做的其他事情是在授权中添加以下内容:

<allow roles="DN\domain users"/>

The regular 常规

<deny users="?"/>

was blocking all access to sub-applications without the roles being allowed at the root level web.config - regardless of the apps having their own web.config that specified their access rights. 阻止了对子应用程序的所有访问,而没有在根级别web.config上允许角色-不管具有自己的web.config来指定其访问权限的应用程序。

此解决方案可覆盖用户对特定文件夹的访问权限,但不能覆盖根应用程序https://serverfault.com/questions/135825/disable-authentication-on-subfolders-of-an-asp-net-app-using-中的所有文件夹Windows的正品

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM