简体   繁体   中英

Publish my MVC3 site on localhost

I am trying to publish my mvc web site on the localhost through visual studio but the problem is when i browse to the the localhost in the browser it gives me a directory listing page. here is the screen shot of publish dialogue. Can somebody please guide me through the process i have been searching for the whole day but couldn't get it to work

在此输入图像描述

here id the global.ascx

 public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute("Facebook",
                           "XdReceiver",
                           new { controller = "Account", action = "XdReceiver" });
            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
    }

Do you have a requirement to use WebDeploy for your publish? If not, you could create a directory and point IIS to that directory and change your publish method to File System.

IMO, WebDeploy is overkill for localhost deployments if you're using it simply for testing. WebDeploy becomes very useful for network deployments since it compares the contents of the directories and maintains which files have been updated and which ones have not.

Try checking the "Mark as IIS application on destination" option. Also, try publishing to Default Web Site/Rental and accessing it as http://localhost/Rental .

If you installed IIS after installing .NET, did you run aspnet_regiis -i ? And could you please post your Global.asax file with MVC routes?

just create a empty site using IIS. and then publish the site in visual studio using the File System publish method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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