简体   繁体   中英

How to deploy a ASP.NET MVC 4 website on IIS8

I have an ASP.NET MVC 4 application and I want to deploy it on IIS 8. I read on the internet that it's possible to do that directly through VS 2010/2013 by creating a package and publish it but I want to deploy it with IIS manager. I tried to do it manually by doing these steps :

  1. Right-Click on Sites (left panel in IIS Manager) > Add a web site.
  2. Specifying the physical path of my project (I've put it on C:), giving a port number (here 3500) and giving a url name (for instance, www.abc.net (or .com)).
  3. Clicking on OK and my web site appears in the left panel.

When I launch my website through Chrome, the browser says that he can't access http://www.abc.net:3500

What am I doing wrong here? What should I do to deploy my MVC website without Visual Studio ?

EDIT : By following Imran's first link, it seems that I made a step ahead. However, instead of access the Index page of my app, that's what the browser displays :

My project folder's list

Should I configure something in my RouteConfig? Here it is :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace AstellasSchedulerV2 {
    public class RouteConfig {
        public static void RegisterRoutes(RouteCollection routes) {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");

            routes.MapRoute(
                name: "Default", // Route name
                url: "{controller}/{action}/{id}", // URL with parameters
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }
    }
}

You can create a deployment package using Visual Studio by going to Build > Publish {project name} and follow the wizard.

In IIS click on a site and there should be an option for Import Application under the Deploy menu. If you don't see this then you need to install the WebDeploy module into IIS .

Alternatively, if you're still developing your solution you can configure Visual Studio to use your IIS installation by going to the project's Properties > Web and choose Use Local IIS Web server . When you run your application it will copy the build over to your default website automatically and run it from there.

Hope this helps.

No idea what you do wrong. Check the logs. Set up a web.config that shows the error when you access the site locally and / or remotely for debugging purposes. Your question is like "I have a car. It does not work. What is wrong?".

Once you enable remote debugging in teh web.config you should see a proper error message.

http://technet.microsoft.com/en-us/library/bb684665.aspx

tells that the settings are:

Change the customErrors mode attribute from "RemoteOnly" to "Off", and then save the file.

and then you should see more than a "Error 500". Making sense out of that is your job then ;)

please refer below articles step by step

IIS 8.0 Using ASP.NET 3.5 and ASP.NET 4.5

and

ASP.NET Web Deployment using Visual Studio: Deploying to Test

EDIT

Publish your website code properly and then try below

1)Please check below configration in global.asax.

RouteConfig.RegisterRoutes(RouteTable.Routes);

2)your route config should be

 routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "your default controller", action = "index", id = UrlParameter.Optional }
            );

3)Disabled Directory browsing in IIS 8.0

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