简体   繁体   English

在同一路由URL下具有多个站点的ASP.net MVC路由

[英]ASP.net mvc routing with multiple sites under the same route url

Good morning, 早上好,

I have a fairly large MVC project with 30/40 controller and a lot of views, i am trying to publish on IIS using multiple application so i can split various sites per different customer. 我有一个带有30/40控制器的相当大的MVC项目,并且有很多视图,我正尝试使用多个应用程序在IIS上发布,以便可以为每个不同的客户拆分多个站点。

I want to use my landing page as the base url: 我要使用目标网页作为基本网址:

https://somewebsite https:// somewebsite

I then want to host multiple applications (eg the same project with different config) as separate applications but under the same main host name. 然后,我想将多个应用程序(例如,具有不同配置的同一项目)作为单独的应用程序托管,但使用相同的主主机名。

https://somewebsite/Customer1 https://somewebsite/Customer2 https:// somewebsite / Customer1 https:// somewebsite / Customer2

Now i can get my multiple websites fine under the seperate host as application, but when i add my landing page (as the full application) its corrupting the other two sites. 现在,我可以将我的多个网站作为单独的主机作为应用程序使用,但是当我添加登录页面(作为完整的应用程序)时,它会破坏其他两个站点。

My thoughts are that the routing in the route app (the one i want just for landing page is causing the issue). 我的想法是路由应用程序中的路由(我只希望用于目标网页的路由导致了此问题)。

Any ideas? 有任何想法吗?

If you are deploying via WebDeploy it will delete subfolders under the host site if they are not part of the host application. 如果通过WebDeploy进行部署,则如果子文件夹不属于宿主应用程序,它将删除宿主站点下的子文件夹。 You can disable this behavior however with a MSBuild argument: 您可以使用MSBuild参数禁用此行为:

/p:SkipExtraFilesOnServer=true

OR during the MSDeploy deployment using the following argument: 或在MSDeploy部署期间使用以下参数:

-enableRule:DoNotDelete

http://www.dotnetcatch.com/2016/02/01/webdeploymsdeploy-quick-tip-keep-existing-files-during-deployment/ http://www.dotnetcatch.com/2016/02/01/webdeploymsdeploy-quick-tip-keep-existing-files-during-deployment/

The issue lay within the web.config of the applications. 问题出在应用程序的web.config中。 The config was being inherited from the master site and causing issues across the board. 该配置是从主站点继承的,并且全面引起了问题。 Set the clear attributes in the child application config and all is well with the applications. 在子应用程序配置中设置clear属性,所有应用程序都可以正常使用。

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

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