views:

483

answers:

5

I bought the Windows Developer hosting package from fasthosts.co.uk, which I believe is a bog standard shared hosting package. It has ASP.NET 3.5 and, according to their support, also has SP1 installed.

I have developed my web app using ASP MVC 2 preview 1 (which by the way is awesome and I'm looking forward to getting stuck into preview 2) and it works fine on my dev machine, on which I have preview 2 installed via the installer package.

As the server doesn't have MVC installed, I followed Phil Haacks bin deployment method which doesn't seam to have worked as the following happens...

When I deploy it and copy the files over to the server I get a plain useless "Server Error 500 - Internal server error". So I modified my web config so that customErrors mode="Off" which made no difference so I figured something is happening that is stopping it from even getting to the customErrors bit.

I then proceeded to take out bits of the web config until it gave me a decent error message. I found that it would only give me an error message if the following bits were taken out the config -

  • The entire configSections section
  • The entire httpHandlers section
  • The entire system.codedom section
  • The handlers and defaultDocument sections of the system.webServer section

I'm using the standard web config that MVC generates with no changes except my own connection string - which I took out for this testing.

Now that I got it to give me an error message, I get the "Could not load file or assembly System.Web.Mvc..." message and I'm stuck! - any suggestions?

Edit:

I bought a new hosting package with someone else and it all worked fine! I was certain it was Fasthosts fault when I deployed an empty MVC app, thanks to Phils suggestion, and then an empty normal web forms app - and they both gave the same errors.

I'm currently in the process of trying to convince them it's their fault, but they keep reassuring me that the problem is with my web config. Tried cancelling my hosting with them but I'm apparently in a 12 month contract even though I opted to pay monthly - oh well.

I guess don't go with Fasthosts would be the one thing to take away from this.

A: 

You need the ASP.Net MVC 2 dll on the server. In your project, select the dll under properties, change "Copy Local" to true.

scottm
Thanks but I have already done that as per http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx
Tom
+2  A: 

It sounds like it's possible you're not deploying to a webroot. Is that the case? Try deploying an empty MVC project.

Haacked
answered by the man himself!
scottm
My web host says all my files should be in my htdocs folder, which I guess is my webroot, and deploying there gives the same problem. Before I was deploying to htdocs/test/ which makes no difference. I have tried both a new empty MVC project and my current one. No luck :(
Tom
htdocs? Isn't that an apache thing? Can you get a normal Web Form page working? If so, write a page that prints out all the server variables.
Haacked
Yeah I thought it was a bit strange. Got a normal web form page that prints out the server variables working fine. Although I did just try deploying an empty normal web application, and that gave the same error as the mvc app - so I guess it's a problem with my host
Tom
A: 

Double check your Global.asax and code-behind ... I think this kind of error happens when the application can't even start (hence you have no other error besides 500).

Have you tried putting in a simple, stand alone ASPX page with no code-behind or anything? If so, do you get the same error? If so, I think ASP.NET 3.5 is not configured for your virtual directory, properly, and you'd have to ask tech support to reinstall/repair or set the version in the ASP.NET tab of the IIS virtual directory properties.

Richard Hein
The support guys put a couple of standard aspx pages in the directory that report the .net version and the date - and they worked fine
Tom
+1  A: 

The error happens because fast host do not allow system.webserver part of the configuration part to interact with the webserver (Very Annoying). I have bin deployed an MVC website to a fasthost account and it partially works... you can view the index page but routing does not work. To get rid of the errors simply comment out the system.webserver section. I have been unable to get the routing to work using .aspx or .mvc extensions :(

darren
A: 

I got my MVC site working as follows:

I added the aspx extension to my default routing map:

  routes.MapRoute(
            "Default", // Route name
            "{controller}.aspx/{action}/{id}", // URL with parameters
            new { controller = "Front", action = "Default", id = UrlParameter.Optional }
        );

  routes.MapRoute(
            "Root",
            "",
            new { controller = "Front", action = "Default", id = "" }
          );

I don't think the Root one actually works because I got a 403, 'No directory listing' error, so I added a default.aspx page to the site which just does a redirect in OnInit to "~/Front.aspx/Default" (note that my default controller is renamed to Front instead of Home).

I changed the three Mvc dlls to be Copy Local so that they were deployed to my site's bin directory.

I used HtmlAction for all my page links so that they automatically got the aspx extension.

I noticed that the site was slower on initial load than using webforms but apart from that everything seems to be okay.

Rob Kent