简体   繁体   English

在无根IIS应用程序文件夹上部署mvc.net

[英]Deploy mvc.net on none root IIS app folder

The title may be a little unclear, but I didn't know how to describe it otherwise. 标题可能有点不清楚,但是我不知道如何描述它。 The problem is the following: 问题如下:

I have an mvc website and 2 servers, a testing server and the real server. 我有一个mvc网站和2个服务器,一个测试服务器和一个真实服务器。 the problem is: the testing server folder is a root folder, so the adress is: 问题是:测试服务器文件夹是根文件夹,因此地址是:

http://www.testingserver.com/ -> this poses no problem. http://www.testingserver.com/- >这没有问题。

but now I have to deploy to the life server which is: 但现在我必须部署到以下生命服务器:

http://www.realserver.com/myappfolder/ ->this is a problem. http://www.realserver.com/myappfolder/- >这是一个问题。

this is a problem because the routing does not work this way, it does: 这是一个问题,因为路由无法按这种方式工作,它可以:

http://www.realserver.com/ {controller}/... instead off http://www.realserver.com/myappfolder/ {controller} http://www.realserver.com/ {controller} / ...而不是http://www.realserver.com/myappfolder/ {controller}

Is ther a valid way to solve this problem ? 这是解决此问题的有效方法吗?

Did you make myappfolder a virtual directory? 您是否将myappfolder设为虚拟目录? Do you have the ability to (do you have full control, or is this a shared hoster)? 您是否有能力(您有完全控制权,还是这是共享主机)?

EDIT: You should be able to change your default route to include myappfolder in the route URL... so change the default "/{controller}/{action}.." to "/myappfolder/{controller}/{action}..". 编辑:您应该能够更改默认路由,以在路由URL中包括myappfolder ...,因此将默认的“ / {controller} / {action} ..”更改为“ / myappfolder / {controller} / {action}”。 ”。

Ok, 好,

I just wrote an ignorerule in the routing in global asax, for now the problems are solved :) 我刚刚在全局asax的路由中写了一条ignorerule,现在问题已经解决了:)

example: 例:

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

It is very strange the routing is working like that for you. 路由如此为您工作是很奇怪的。 Are you using Url.Action to create those urls or are you just doing '/{Controller}/Action'? 您是使用Url.Action创建这些网址还是只是执行'/ {Controller} / Action'?
You should always use Url.Action and Url.Content for urls in your html if you want to avoid problems when deploying to a different root directory 如果要避免在部署到其他根目录时出现问题,则应始终在HTML中使用Url.Action和Url.Content作为URL。

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

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