在非根 IIS 应用程序文件夹上部署 mvc.net
标题可能有点不清楚,但我不知道如何描述它。问题如下:
我有一个mvc网站和2台服务器,一个测试服务器和真实服务器。 问题是:测试服务器文件夹是根文件夹,因此地址是:
http://www.testingserver.com /->这没有问题。
但现在我必须部署到生命服务器,即:
http://www.realserver.com/myappfolder/ ->这是一个问题。
这是一个问题,因为路由不是这样工作的,它是这样的:
http://www.realserver.com/< /a>{controller}/... 改为关闭 http://www.realserver.com/myappfolder/{controller}
是否有有效的方法解决这个问题吗?
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.
the problem is: the testing server folder is a root folder, so the adress is:
http://www.testingserver.com/ -> this poses no problem.
but now I have to deploy to the life server which is:
http://www.realserver.com/myappfolder/ ->this is a problem.
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}
Is ther a valid way to solve this problem ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否将 myappfolder 设置为虚拟目录?您是否有能力(您是否拥有完全控制权,或者这是一个共享托管服务商)?
编辑:您应该能够更改默认路由以在路由 URL 中包含 myappfolder...因此将默认的“/{controller}/{action}..”更改为“/myappfolder/{controller}/{action}”。 .”。
Did you make myappfolder a virtual directory? 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}..".
好吧,
我刚刚在全局asax的路由中写了一个ignorerule,现在问题已经解决了:)
示例:
Ok,
I just wrote an ignorerule in the routing in global asax, for now the problems are solved :)
example:
路由对你来说是这样工作的,这很奇怪。您是使用 Url.Action 创建这些 url 还是只是执行“/{Controller}/Action”?
如果您想避免部署到不同根目录时出现问题,则应始终对 html 中的 url 使用 Url.Action 和 Url.Content
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'?
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