Setting up mvc application on IIS7? - asp.net-mvc

I've created a MVC website using Visual Studio 2010 and would like to deploy it to my newly installed local IIS7. The website works perfectly running from Visual Studio on the development server that it comes with.
Here are the steps I've done:
1) Opened IIS7 Manager.
2) Under Sites created a new site called Foo.
-- I used the DefaultAppPool which is set to .net4 integrated
-- I created a empty directory and used it as the default path
-- I set the port to 54321
3) I then in Visual Studio used the publish button with local IIS and the site set as Foo.
IIS Manager now shows the following under sites:
Foo
bin
content
scripts
views
When I go to localhost:54321 I am given a message saying it can't list the directory. If I put a index.html file in this directory it will launch the file as expected. I guess I'm missing something big here. I published my site to this directory. When I go to localhost:54321 I expected it to launch the index view of the home controller, but it just tries to list the directory.
Found the answer here:
ASP.NET MVC on IIS 7.5
Can't answer my own question cause I have less than 100 points :)

The new server is missing the ASP.NET MVC 3.0. Install it using standalone ASP.NET MVC 3 installer.

Related

What do I need to do to get MVC to work on IIS7? Does not show page, just shows directory

I've just file system deployed an intranet site to one of our internal servers. The site is configured with it's own application pool w/.net 4. The site is configured to allow anonymous access. The NetworkServices account has read access to the directory/s. For trouble shooting purposes I have directory listing enabled.
When I hit the site I get the directory listing, why does the home/index page not come up as expected? Other servers that I have deployed to have just worked. I can not seem to find a difference here.
Also I have the site configured to come up as http: //myip:8081/
I've already run aspnet_regiis -I and checked to make sure the pool was the correct version.
I rolled back my .Net version from 4.5.1 to 4 and reinstalled all the nugget packages.
I have copied local all the DLLs just to be sure.
The original project was targeted to .Net 4.5 and I had down-converted to 4. I thought I had changed all references and configuration items but I must have missed something.
I created a new project targeting .Net 4 and copied my code files into the new project.
Compiled and deployed and all worked correctly.
Not sure what item in the web.config wasn't changed (or maybe something else in the project) but this worked and was fairly quick.

how to deploy ASP.Net MVC 4 application on IIS with bin folder

I have tried these steps but could not make it. When I browse my app it shows dll file.
Log onto the machine that is or will be hosting your application.
Use IIS Manager to create a new website for your application.
Create a new application in that site. I believe this also will automatically create an application pool with the same name for you and use it by default.
Specify the virtual directory for your application. This is going to tell IIS where to look for your mvc application. For this case lets assume it is C:\myApp
On your own machine Build the application however you build it with the correct solution configuration (i.e. Release mode). Lets say the result of your build is located at C:\MyProject\bin.
Copy C:\MyProject\bin from your machine onto your hosting machine at C:\myApp
I am a novice to this technology.
you shouldn't just drag the bin folder. it is everything else too like the images, css, jscript files as well as the cshtml files too (your views) to the c:\myapp folder.
or perhaps just do a publish within visual studio. maybe even take a look at this to see if this helps:
How to publish my MVC 3 web application onto IIS7
but generally speaking, I build the solution. I then create the vdir in my IIS. I copy the bin and view folder along with images/css/jscript/shared folders etc... to C:\my deployed site. I then convert to application for that vdir I just created in IIS.
You have to use publish action for ASP.Net web application(MVC, Forms and etc.)

Problems deploying MVC 4 application to website already hosting classic ASP

I am in the introductory steps of teaching myself ASP.Net MVC 4 with the intent of converting old Classic ASP code. So, I have made a simple Hello World application in MVC4 and want to deploy it to our development server. The development server currently mirrors our production environment. The production environment hosts a bevy of Classic ASP pages, hosted in the "web" directory.
I have used the publish button in VS to upload the hello world page to the dev server, dropping it into the "web" directory. So, within the "web" directory, there are 2 new folders /bin and /Views. The actual page I created resides within the /Views/Home directory.
After the code was uploaded I pulled up IE and attempted to view the hello world page by navigating to localhost/views/home/index.cshtml and I received a 404 error.
I then pulled up the directory listing in IIS and navigated down to the "home" directory. I right-clicked this folder and selected "convert to application".
At this point I was able to see my hello world page by directing IE to the root localhost. However, after removing the "home" directory from the application list (essentially undoing the "convert to application"), the hello world page still shows when I pull up the root directory in IE. I've checked the default pages list in IIS, and my Classic ASP homepage still lists as the first selection.
So, I'm kinda confused on how to make MVC and classic asp play nicely together. First and foremost, I'd like to get my dev server pointing back to it's original default page so that it matches the production environment.
Create a separated directory for your MVC4 application beside the web directory. After this create a new web application inside the IIS console and point the source directory to your new application directory (set the new application's AppPool to integrated). Everything should work fine.

ASP.NET MVC and host problems

Hi,
I have done the following :
Start Visual Studio 2010
New Project > ASP.NET MVC
Default ASP.NET MVC project generated by VS2010
Add a couple off simple buttons on the first page
Start local IIS manager, Create a web application and point it to the ASP.NET MVC project
Set correct right on the ASP.NET MVC project folder(to the user running the thread pool in IIS7)
Browse site (http://localhost/MyTestSight/) and the first page is shown
Upload site to www.test.figurspel.net
Host sets the site to be runned on .NET 4.0
Browse www.test.figurspel.net and the site is not working?
The host has checked that tha Active Server Page is set to allow
Host has installed up to MVC 3
I could turn on the Browsable to see the file structure but this will not help to get the site running.
How do I get this asp.NET MVC web site running?
BestRegards
Is the application pool running in integrated mode the IIS site running under that application pool?
It's my understanding that if this isn't the case, the MVC site will not run.
Alternatively, have you tried this?
+1 Unicorn power HooooooO!!!!! Also I've always when hosting a site published the project to a different folder then setup the site via IIS from that folder hope this helps.

Routing problem with particular controller name using ASP.NET MVC 1 in IIS 7

I have joined a team developing an ASP.NET MVC version 1 application. I run this app on my local machine using IIS version 7.5. My operating system is Windows Server 2008 R2 Enterprise Edition. I use Visual Studio 2008 SP1 for development.
One of the controllers in this app is called ReportsController. The route table entries for this controller use 'Reports' as the controller name part. The problem I have is that, using IIS 7.5 on my local machine, I simply cannot access any of the Reports action methods. If I try to access, say, '/Reports/Index' from Chrome or Firefox, I get a 401 Unauthorized response (as seen using Fiddler) and the browser displays its username/password entry dialog.
Please note the following:
All other non-Report pages in the application work correctly.
If I add a breakpoint to Application_BeginRequest, it is not hit when requesting a Reports page.
If I change the Reports routing entries in the route table registration code so that I have to access paths like '/Reportss/Index' (note the extra 's') then these Reports pages work correctly.
I have tried deleting then recreating my Web application in IIS.
The Reports pages work fine if I run the application using the Visual Studio 2008 development server (Cassini).
There is no directory called Reports in the application directory.
The Reports pages work correctly on our UAT environment, also under IIS 7.5.
I have reviewed my IIS setting several times, including comparing them with those on UAT, and I can't see a problem.
While I can use Cassini to access the Reports pages, I would really like to understand what is causing this issue.
If you have Reporting Services installed on your machine. try to create a new web site and use it. If you have SSRS installed on your machine it uses /reports for hosting reports.
I have had problems using the directory name 'Reports' at the root of a .net 2.0 website on IIS 7.5. It generates a 503 Error, indicating that there is an error at the system level before IIS tries to serve the page. I am not sure if reporting services is installed on my server. I just changed the directory name, all links and everything worked.
I have the exact same issue in my MVC Application with reporting services installed on the same server where code was deployed. I have changed the Reporting Manager URL in "SQL Server Reporting Services Configuration" which was hostName/Reports and assigned a new name i.e. SSRSReports so the virtual directory is now hostName/SSRSReports.
Now my application as well as SSRS Reports are working as expected.

Resources