MVC4 WebSite 404 Error on IIS7 - asp.net-mvc

Set-up
I have a website built in Visual Studio 2012 using MVC 4 and .NET framework 4.5.
It is being hosted on a Windows 2008 and running IIS7.
I am using a VS2012 "Web Deploy Package" to deploy to the server. I manually copy this to the server and run the install using the web deploy cmd script option /T and then /Y. It all installs fine to the Test folder.
On the Test website in IIS the application pool is pointing to the DefaultAppPool which is set for integrated and pointing to the .Net Framework v4.0.30319
I have created a new Web Site in IIS for the application called Test and defaulted the bindings for port 80 and stopped the default web site that is in IIS.
I've created a new foldeer called Test under wwwroot which is where the Web Deploy script is set to point to, when I created the script I add "Test" as the Site/Application
When I have created the web deploy package on my local machine I am manually copying the zip file and other deploy files (cmd,*.xml) to the remote server
I have run %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i on the server and installed .net 4.5 framework and MVC framework components I could see in the Web Platform installer.
Problem
This website was previously being hosted on Windows Azure and have been able to direct publish to Azure and everything runs fine and when I go to any page it displays as expected.But on the new web server I get a 404 when I go to any page.
Everything seems to be installed as far as I can see on the web server. I was able to stop my website and re-start the default web site and add an index.htm file and that displays fine.
It almost seems like something in the MVC pipeline is not initialising. I'm using the standard Home controller with Index action that comes as part of the VS20102 MVC template as a test and that returns me a 404 when I go to /Home.
I've also tried other endpoints (I have WEB api rest endpoints off /API/* and these are returning 404 errors).
I'm just wondering if there is some basic set-up I've missed. It almost seems like some service is not running correctly and picking up the MVC website.

Related

Deploying MVC file system publish on IIS7

I have created an MVC application in Visual Studio 2013 and I now wish to deploy this on the IIS of the server so that all employees from within the company will be able to access it via their windows login credentials.
When I run this in localhost via Visual Studio debug it works as expected but I have been trying unsuccessfully to deploy this to a network server and I am unsure of the process and would be grateful for some clarification.
I chose a file system publish from the publish options but I am unsure as to how to get this accessible as an application. I have tried adding the files via the new website wizard and tried the url of 'holidays/' which I had entered but without success. I then tried to add the same virtual directory location as an application from within this website but again this was unsuccessful.
I use Web Deploy with VS. Your target server needs to also have Web Deploy:
Installing and Configuring Web Deploy on IIS 7
Once your target server is ready, you can deploy from VS. Here's a guide on doing that (you can jump right to "Publish to IIS" section if you like):
ASP.NET Web Deployment using Visual Studio
With Web Deploy, you can choose to publish directly or use a deployment package. Once you are happy the publishing works locally, you have a level of confidence your publishing will work in your Live environment.
I would suggest that before you publish direct to a live environment, that you test publish it to your local machine or a test environment that has the same IIS version, and .NET Framework installed.

How to deploy an asp.net mvc app to IIS 8 on azure virtual machine

Trying to deploy an asp.net mvc application with IIS 8 on azure virtual machine but Im getting the following error:
This is what ive done so far in azure Virtual machine:
Installed IIS
Installed Web deploy 3.6, web deploy for hosting server, web deploy tools 2.1, web deploy without sql bundled support
In IIS azure Virtual machine:
Created a website "Nextix" in IIS
Disabled Default Web site in IIS
In my Visual Studio 2013 (asp.net mvc project), selected publish -> web deploy package
Copied the deployed package to the virtual machine
In IIS, clicked website "Nextix" and selected import application
Followed all instructions in Import Application Package Wizard to install Web deploy package
I also installed ASP.net 4 in iis by following the instruction in the link
ASP.NET MVC on IIS 7.5
After the steps I did, this is how my IIS application pools looks like:
And how the advance settings of my nextix website looks like:
Is there something else I need to check or do? Im still getting the above error message screen.
Fixed by following the instruction in this link: http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-using-aspnet-35-and-aspnet-45

IIS and MVC show folder structure

i have tried to deploy an mvc application in an windows server 2008 with iis7.
i have copied all the content to the inetpub/wwwroot folder
i changed the framework version of the application pool to v4.0
i ran the aspnet_regiis.exe
the project was properly released because i have deploy succesfully to my desktop dev (iis) and one arvixe hosting, but i cant make it work on the server.
but i can only see the folder structure, i tried creating virtual directorys and everything, but nothing works. am i missing something.
thx

Deploying ASP.NET Application on IIS7

I am developing an ASP.NET MVC 4.5 application in C#. It works flawlessly when I run it after compiling on my local IIS Express.
However, when I try to upload it to a remote server it does not seem to recognize anything in its root directory. It only displays the default welcome screen.
I have tried reconfiguring the web.config file to point to Global.asax file, without any success. I am able to load single images by modifying the URL according to the sites structure.
What is the initial "starting file" on ASP.NET MVC 4.5 and how do I configure IIS7 to load it?
Check you server configuration (if possible), first enable Web Server (IIS) role (is posible to add from Server Manager or PowerShell), then install .NET Framework, or use aspnet_regiis.exe from .net framework folder (C:\Windows\Microsoft.NET\Framework\v4.0.30319 and C:\Windows\Microsoft.NET\Framework64\v4.0.30319) if server has configured iis web role and .net framework installed but configured incorrectly. If unsure what role features to add use Web PI and add IIS Recommended Configuration (http://www.microsoft.com/web/downloads/platform.aspx)
Note: In Visual Studio 2012 project template for MVC 4 Web Application references as copy-local MVC Assemblies from NuGet and therefor you don't need to install MVC 4 on web server.
Command to register current .NET version (from folder wich you are executing this utility, execute for both, first for 32-bit and than for 64-bit on 64-bit OS) with IIS:
aspnet_regiis -i
PowerShell to add Web Server role:
PS> Import-Module ServerManager
PS> Add-WindowsFeature Web-Server
If you see the default IIS welcome screen then it's probably because of incorrect website bindings (IP:port:hostheader). Whenever IIS cannot locate a website with specific binding it falls request back to "Default Web Site" with *:80 binding which you probably observe.

ASP.NET MVC Deployment Referencing Development Environment

I am trying to deploy my ASP.NET MVC 3 application using Visual Studio 2010's "Publish Web" option (build/Publish App). This generates deployment/bin, deployment/scripts, deployment/views etc.
I loaded these resulting deployment files/folders to a web server running IIS 6. Afterwards, everything seemed to run just fine on this web server.
I then started to make new updates, just to my local environment. After doing that, the deployed version of the site stopped working. I looked at the stack trace and the web server seemed to be referencing controllers.cs from my local environment, as opposed to the dll's in the bin directory on the web server.
Is there something else I need to do before deployment to tell the web server to use it's own bin files as opposed to files on my development environment?
BTW both my development machine and the web server live on the same network.
Update:
Another thing that made me suspect that the web server was referencing my local dev environment was that when a new user tried to access the application she got an IOFileNotFoundException in regards to a reference to "Interop.ActiveDs.dll". The stack trace mentioned my_local_path/Interop.ActiveDs.dll. This file was in fact not on the web server so I added it and then her error went away. The Odd thing was that all other users before her did not recieve an error about this missing reference.

Resources