asp.net-mvc – ASP.NET MVC和IIS 5

前端之家收集整理的这篇文章主要介绍了asp.net-mvc – ASP.NET MVC和IIS 5前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
什么是获得托管ASP.NET MVC应用程序在IIS 5(6或7)上工作的最佳方式。当我试图发布我的ASP.NET MVC应用程序,我似乎得到的是404错误。我做了一些googleing,找到了几个解决方案,但似乎并不优雅,我担心如果他们将无法使用一旦我使用共享托管环境的应用程序。

Solution 1

  1. Right-click your application virtual directory on inetmgr.exe.
  2. Properties->Virtual Directory Tab-> Configuration.
  3. Add a new mapping extension. The extension should be .*,which will be
    mapped to the Executable
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,
    or the appropriate location on your
    computer (you can simply copy this
    from the mapping for .aspx files). On
    the mapping uncheck “check that file
    exists”.
  4. 3 X OK and you’re good to go.
  5. If you want,you can apply this setting to all your web sites. In
    step1,click on the “Default Web Site”
    node instead of your own virtual
    directory,and in step 2 go to the
    “Home Directory” tab. The rest is the
    same.

看起来有点黑客通过ASP.NET路由一切。

Solutions 2

编辑MVC路由以在URL中包含.mvc,然后按照基于此扩展的解决方案1中的步骤。修改:原始图片链接已丢失,但此处是来自Google的缓存:

解决方法

答案是 here

If *.mvc extension is not registered
to the hosting,it will give 404
exception. The working way of hosting
MVC apps in that case is to modify
global.asax routing caluse in the
following way.

routes.Add(new
Route(“{controller}.mvc.aspx/{action}”,
new MvcRouteHandler()) {
Defaults = new RouteValueDictionary (new{ controller
= “YourController”} ) });

In this way all your controller request will end up in *.mvc.aspx,which is recognized by your hosting. And as the MVC dlls are copied into your local bin,no special setttings need to be done for it.

原文链接:https://www.f2er.com/aspnet/254094.html

猜你在找的asp.Net相关文章