8

I use VisualStudio to build a C#-MVC3 Website and it works great.

I need to install the website on a different computer to check it. The computer has IIS7.

I tried to install (my first time... I don't really know IIS), and when I browse the site (localhost/mySite) I can see all the directories (controllers, views...) but I can't see the site itself.

I can see a specific file (like localhost/mySite/Content/img.jpg) but I can't see the site with the controllers (localhost/mySite, or localhost/mySite/Home)

What to to?

4

4 に答える 4

16

最初にASP MVCをインストールしてから、アーキテクチャに応じて次のいずれかを実行します。

32 ビット (x86) Windows

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir

64 ビット (x64) Windows

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir

詳細については、このスレッドも確認してください: ASP.NET MVC on IIS 7.5

これらの手順の後、アプリケーション/サイトを再作成する必要がある場合もあります。

于 2012-04-30T09:13:33.173 に答える
2

Is MVC3 installed? It is the most common cause when publishing MVC sites to another PC

于 2012-04-30T09:08:57.887 に答える
0

Global.asax.cs のような MVC の既定の設定が既にある場合は、App Pool Managed Pipeline Mode を Integrated に変更します。

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
        "Default", // Route name
        "{controller}/{action}/{id}", // URL with parameters
        new { controller = "Home", action = "Index", id = UrlParameter.Optional });
}
于 2015-04-14T12:17:53.947 に答える