0

I just deployed an mvc project to our testing server. During development, my project was auto-deployed into the local IIS Express and could be reached in

http://localhost:62599/api/

I uploaded the project files on machine "server03" in IIS7's "deploymenttest" site, subfolder "api", and now I try to call the project from my browser, only receiving 404s or 403s.

Which URL does the project have now?

tereško
  • 58,060
  • 25
  • 98
  • 150
Alexander
  • 19,906
  • 19
  • 75
  • 162
  • The URL must be `http://server03/api/`, where after `server03` you'll want the port if you changed it (e.g. `server03:4567/`), and between hsot and `/api/` you'll want the application directory if you moved the application in one, like `deploymenttest`. Your final URL may look like `http://server03:4567/deploymenttest/`. You can just click 'Browse' from IIS though. – CodeCaster Nov 13 '13 at 08:04
  • possible duplicate of [Install MVC website on IIS7](http://stackoverflow.com/questions/10381016/install-mvc-website-on-iis7) – CodeCaster Nov 13 '13 at 08:09
  • When I click 'Browse' from IIS, the main page (HTML/JS) in the root dir is opened. The mvc application in the api folder isn't touched in any way. – Alexander Nov 13 '13 at 09:36
  • But you're asking for your site's URL. You have it. If you have an actual error when accessing that URL + `/api/`, see the question I linked as duplicate for troubleshooting. – CodeCaster Nov 13 '13 at 09:38

1 Answers1

0

when you deploy an mvc project into IIS, make sure following

  1. You copied all the Views(with their directory structure) and the bin folder to the location, you have pointed in your IIS website or Virtual Directory. Also do note that, sometimes Visual Studio Publish, doesn't publish all the required dependencies.Besides, you don't need to copy any of your .cs files to the deployment.

  2. your web.config has following in its system.WebServer

    <system.webServer>
      <modules runAllManagedModulesForAllRequests="true" />
    
  3. your IIS module has UrlRouting module.(goto IIS, select your application on the left, then in the IIS section in the right, look for Modules icon and double click, and see if UrlRouting4.0 or something like that exists)

  4. Also make sure, depending on the dot net version of your app, your IIS supports that version. Simple way to find that out, is to go in the IIS manager, go to ApplicationPools, edit any pool and see in the dropdown, what options are available. .NET Framework v4.0.30319 is for DOT NET Version 4.5

additionally, if you want to install ASP.NET support for your IIS, go to Turn Windows Feature On and Off and select everything that is inside the Node "Internet Information Services".

Manish Mishra
  • 12,163
  • 5
  • 35
  • 59
  • I can't find UrlRouting in the modules list, and I can't find it under "Add module..." – Alexander Nov 13 '13 at 07:58
  • in that case, you need to register asp.net to your IIS. run this command in Visual Studio command prompt `aspnet_regiis -i` – Manish Mishra Nov 13 '13 at 08:01
  • And now I have to find out how to add .NET 3.5 or higher to IIS7. :) – Alexander Nov 13 '13 at 08:01
  • 1
    This partially answers _"How to set up IIS for ASP.NET MVC?"_, while the question at hand is: _"What is the URL for a site deployed in IIS?"_. – CodeCaster Nov 13 '13 at 08:01
  • God, no, that's not fair. anyways @Alexander, simply select your application in IIS, right click>>manage website>>Browse. – Manish Mishra Nov 13 '13 at 08:03
  • @CodeCaster, if you could read the comments, there is no UrlRouting module in his IIS, so even if he would have worked out the url, he would have ended up for this answer, in that case, i think, i should be upvoted, twice – Manish Mishra Nov 13 '13 at 08:05
  • That was just a guess from your side. You can't copy paste the ASP.NET MVC setup FAQ on every MVC question in the hope one of the steps solves the problem at hand. – CodeCaster Nov 13 '13 at 08:06
  • hey, @CodeCaster, bad day? anyways, you are guessing now. I spent two days, figuring out why my MVC 4.0 project works when fired through Visual Studio but not when through IIS. Setting up IIS took me 20minutes, but the fact that some of the dependencies were missing, cause I was publishing my webproject through visual studio, took me 1.5days. I don't care, what pissed you off, but it is not standard MVC setup FAQ – Manish Mishra Nov 13 '13 at 08:09
  • @CodeCaster if you think this answer does not cover my question, then please tell me the URL where I can access my project. FYI: I did everything as described in http://msdn.microsoft.com/en-us/library/dd410407%28v=vs.90%29.aspx – Alexander Nov 13 '13 at 08:13
  • @Alexander. right click your application in iis, goto manage and click Browse. – Manish Mishra Nov 13 '13 at 08:15
  • @Alexander see my two comments on your question. – CodeCaster Nov 13 '13 at 08:30
  • @CodeCaster downvote, typically means, misleading answer or wrong answer. Besides I preferred, minimum steps and not all-the-possible steps(one google search) to lead him in right direction. (Won't let the glory of my typing and formatting in numbered list go away...i didn't copy, didn't even see whether is it a possible duplicate :D) – Manish Mishra Nov 13 '13 at 08:45