简体   繁体   English

我想在现有 angular6 应用程序的虚拟目录中部署 ASP.Net Mvc 应用程序

[英]I want to deploy ASP.Net Mvc application inside virtual directory of existing angular6 application

I have an existing Angular website in that I want to deploy ASP.NET MVC application inside the virtual directory.我有一个现有的 Angular 网站,我想在虚拟目录中部署 ASP.NET MVC 应用程序。 the problem is when I try to route to ASP.NET MVC application inside a virtual directory it shows "403 - Forbidden: Access is denied."问题是当我尝试路由到虚拟目录内的 ASP.NET MVC 应用程序时,它显示“403 - 禁止:访问被拒绝”。 error on IIS. IIS 上的错误。

I tried adding a new url rewrite rule in web.config of an angular application as given in我尝试在 angular 应用程序的 web.config 中添加新的 url 重写规则,如下所示

https://www.stefanoscerra.it/iis-rewrite-rules-configuration-angular-web-config/ https://www.stefanoscerra.it/iis-rewrite-rules-configuration-angular-web-config/

but it tries to find the angular route and if not match any angular route it redirects to the angular default route但它试图找到角度路线,如果不匹配任何角度路线,它会重定向到角度默认路线

In I was having same scenario like this I solved by adding rewrite rule URL rewrite configuration in web.config .You will need to add rewrite rule like below.在我遇到这样的情况时,我通过在 web.config 中添加重写规则 URL 重写配置来解决。您需要添加如下重写规则。

<rule name="mvcinsideangularrule" stopProcessing="true">
      <match url="mvcvirtualdir/(.*)/(.*)/(.*)" />
      <action type="Rewrite" url="http://yourdomain.com/mvcvirtualdir/{R:1}/{R:2}/{R:3}"/>
</rule>

It will work in your scenario.它会在你的场景中工作。

你在 IIS 中的重写配置看起来像..

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

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