birdus
birdus

Reputation: 7504

Default route in MVC working from VS, but not on test server

I have a very simple ASP.NET MVC 4.0 website. It's got a single controller ("HomeController") with a single action ("Index") which receives a single parameter ("string id"). I have not modified the global.asax file since this kind of route is handled by default. I have not created a view for this action since the action will simply be "sending" the user a file (a PDF). If I run the site from within Visual Studio (using a default page of "home/index/3" in project properties), the page runs fine. If, however, I publish the site to our test server (https://ourserver.com/mysite/home/index/3), I get a 404--File or Directory not found.

NOTE: We're running IIS7.5 on this server.

UPDATE: The bin dir (and the appropriate DLL, i.e., one named after the project) and the web.config file are there.

So, why is this not working?

Upvotes: 0

Views: 638

Answers (1)

Erik Noren
Erik Noren

Reputation: 4339

If you're using an older version of IIS and haven't installed the MVC server extensions which give you routing, you can do a BIN deployment of the necessary infrastructure files.

Edit: If you're running IIS 7.5 you should have everything you need. You mention you don't see a web.config file or any dlls - how did you publish? You should absolutely have a web.config at the root of the publish directory and a bin folder with your dll(s).

If you right-click on your web project and do Publish, you can publish to a local directory. It'll be exactly what you should see when deployed.

Edit 2: Did you check that it's configured in IIS as a web application and not just a site?

Upvotes: 1

Related Questions