Solved

Deploying Asp.Net MVC 4 to IIS 6.0

Posted on 2014-03-24
5
2,029 Views
Last Modified: 2014-05-21
Hi all;
We have a virtual server running Windows Server 2003 R2 in VBox on a developer machine in order to emulate the Data Center's web server and SQL Server.

After some difficulties I carried out a file system publish of a Asp.Net MVC 4 web app.  I copied it to our Virtual server under a new directory under InetPub called DeployedWorkingModels.  So here is the path: C :\Inetpub\DeployedWorkingModels\WorkingModel-40

 I created a new Web Site called "WorkingModels" in addition to the "Default Web Site" like the Data Center would do.  I made the Home Directory C :\Inetpub\DeployedWorkingModels.   I created a new AppPool called AppPool40 like the Data Center will do.  (However in IIS 6.0 I was not able to find any place where you could configure which framework the AppPool would use.)

I configured the folder WorkingModel-40 as a web application under "WorkingModels"
I configured the new app to use the new AppPool40.  Then I right clicked on the web application and selected "Browse".  I got "Internet explorer could not display page".  I downloaded WFetch and ran it on that web app and it informed me that the issue was a 404 error.  I right-clicked on the web site and selected "browse" and it got 404.  I right-clicked on the index.cshtml page of the Home directory of the views directory and selected "browse" and got  a 404 error.  I asked for help on several sites.

After getting no help on this I started making changes.
I copied the folder for my project "WorkingModel-40" directly under wwwroot.  Then I opened IIS.  I configured my project "WorkingModel-40" as an application directly under "Default Web Site".  Then I right-clicked on the web application and selected "Browse".  This time for the URL http://localhost/WorkingModel-40 I got a 403 error.  When I drilled down to the Views/Home/Index.cshtml file for the URL http://localhost/WorkingModel-40/Views/Home/Index.cshtml I get a 404 error.

Based on guidence from www.Asp.Net, I ran the aspnet_regiis.exe from the  Framework64 folder.  I right-clicked on the site again.  Same 403 error.
 
The same person said the issue was that NetworkService did not have permissions to the folder.  so I made sure it was added to the folder with full rights.  Same 403 error.

I was provided a link with instructions on how to fix this.  This site http://technet.microsoft.com/en-us/library/cc737351(v=WS.10).aspx said to run this command

cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 true 

Open in new window


In the Inetpub\AdminScripts directory From the command prompt.  This result in the "browse" menu item returning "Service Unavailable".  It resulted in these errors in the System Event Viewer:

A process serving application pool 'AppPool 40' reported a failure.
The process id was '2064'.  The data field contains the error number.

The data field contained this error code:  800700c1


I tried running this script to change it back to false.  
No difference.
I tried stopping and restarting the service serveral times no difference.

Next day I did a restart and a hard shutdown.
I was provided this link.  http://support.microsoft.com/kb/894435/en-us
which had me change the script script I ran to
adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 0 

Open in new window


and then run
aspnet_regiis.exe -i 

Open in new window


 After this was done, I was back to the browse showing 403 and 404
 
I tried changing the routing in the routeconfig.cs using the method referred here http://www.asp.net/mvc/tutorials/older-versions/deployment/using-asp-net-mvc-with-different-versions-of-iis-cs
to add ".aspx" to the controller in the routing.  That did not work.

I created a new folder called WebSiteName  
I put a wwwroot under that folder.  
I deployed my published app under that folder.  
In IIS I created a new web site with port of 81.  
I made the home directory of this web site be the wwwroot folder just created.  
I configured the deployed app as an application.  
then I clicked "Browse"  This time I got

[To Parent Directory]

       Friday, March 14, 2014 12:11 PM        <dir> bin
       Friday, March 14, 2014 12:11 PM        <dir> CodeTemplates
       Friday, March 14, 2014 12:11 PM        <dir> Content
  Wednesday, January 22, 2014  9:27 AM        32038 favicon.ico
       Friday, March 14, 2014 12:11 PM        <dir> Images
       Friday, March 14, 2014 12:11 PM        <dir> Models
       Friday, March 07, 2014  3:26 PM         2789 packages.config
       Friday, March 14, 2014 12:09 PM           49 PrecompiledApp.config
       Friday, March 14, 2014 12:11 PM        <dir> Scripts
       Friday, March 14, 2014 12:11 PM        <dir> Views
       Friday, March 14, 2014 12:09 PM         5251 Web.config 

Open in new window


However any attempt to click browse on any of the views in the views folder still results in 404.  In addition, any attempt to connect to the site using IE results in 404.

This was all entered in a previous post with me updating it each time I tried something new.  The administrators of experts Exchange told me that because I was entering new posts, it appeared to experts that there was activity on the question.  I was advised to delete it and start over.  

So this is a new post whose original post contains all the steps I've taken.  I really hope someone can answer it this time.
0
Comment
Question by:Edward Joell
  • 4
5 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39951046
My initial guess, based on what you have described, would be that you need to add a "wildcard mapping" to your site. Because MVC works with extensionless URLs you need to configure IIS to not require an extension, and to not need a physical file to exists at the URL.

You can find details of how to configure the mapping under the "IIS6 Extension-less URLs" section of this page: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx/
0
 

Author Comment

by:Edward Joell
ID: 39951238
Yes I read about those in that very article. That may work on the development site.   My concern would be with the Production Server.  As I read the article, every single request to the server would need to be evaluated by ISAPI.  I don't know if the Navy's Data Center would be willing to configure a web app on their web server that way.

However, I tried it on our development Virtual Machine.  It made no difference.  Still "Cannot find server or DNS Error Internet Explorer "  

I see I left out a few steps that I had taken before.  I will update the OP so that you can be aware of everything I've tried.
0
 

Author Comment

by:Edward Joell
ID: 39951303
It appears I cannot edit the original post, as there is no edit link on the page for the question.  so this is the additional information I needed to provide you.

This article http://www.asp.net/mvc/tutorials/older-versions/deployment/using-asp-net-mvc-with-different-versions-of-iis-cs speaks about artificially using an aspx extension in the mapping.

You will also note the article "http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx/
" speaks about a "default.aspx.cs" file in the MVC app. My latest issue mimics that which he showed as being due to the rewriteparth statement in default.aspx.cs.   There are no aspx files in an MVC 4 Razor app, much less a default.aspx, and there is no "rewritepath" method referenced in the entire solution. It appears he is talking about an earlier version of MVC.

I read the article  http://johan.driessen.se/posts/getting-an-asp.net-4-application-to-work-on-iis6 .  I enabled 4.0 Framework as instructed.  I ran the web site in Browse, and because the browse issues a standard http request, and the application is designed to run in SSL, the application, as designed, issued an error saying that it could not see a client certificate.  So that worked.   So I went into the properties of the web app and edited the Secure Communications panel to require SSL and to require client certificates.  When I did the right click browse this time I was informed that web site requires SSL communications. As it is supposed to.  

Unfortunately the browse menu item did not show me the URL that it used call the web site.  The Website is called ProcTest40 the web app under that site is called ProcTrackTest40.
So at a guess I called:
     
Each one delivered "Cannot find server or DNS ErrorServer or DNS error".

Since I am not on the DefaultWebSite I did not think that Localhost/Home/Index would work.  But in desparation I tried any way.

It also occurred to me, that IE on the VM would not be able to read my client cert from my CAC Card anyways, so I then tried connecting to the server from the host machine using all of the above URLs with the VM's server name. such as https://cpvfssql200364:443/ProcTrackTest40/Home/Index  .  This time the Error was always "Internet Explorer cannot display the webpage".  When I tried to start the "Diagnose Connection Problems" troubleshooter, I got "An error occurred while troubleshooting.  A problem is preventing the troubleshooter from starting" with an Error Code 0x800B010E which appears to mean unknown error.

So to summarize:

•I can access the web app from the browse menu item in IIS when it is NOT configured as SSL (which will make it throw an error), but NOT from IE on the VM because of "Can't find server or DNS Error", or from IE on the host because of "Internet Explorer cannot display the webpage."
•I cannot access the web app from the Browse menu item because it needs SSL when it is configured as SSL, and NOT from IE on the VM because of "Can't find server or DNS Error" and not from IE on the host because of Internet Explorer cannot display the webpage."

Update:  By removing the requirement for SSL from the web page and typing in http://cpvfssql200364:81//ProcTrackTest40  (the port of the new ProcTest40 website), I was able to connect to the web app from the host machine.  However, as noted, since it is designed to work with SSL and pull cert_subject from the server variables it threw an error as designed.

However when I configure SSL on the site and try to connect from the host I get "Internet Explorer cannot display the webpage."   I tried changing the default SSL Port and using it in the URL.  Same error.  

We are very close.  Can you help?  (I wonder what ports VBox opens between host and guest.)
0
 

Accepted Solution

by:
Edward Joell earned 0 total points
ID: 40071159
We decide we are not going to deploy to IIS 6.0, that we will just wait until the new servers have been stood up and tested.  Thank you everyone for your assistance and help.
0
 

Author Closing Comment

by:Edward Joell
ID: 40079958
This is a poor's man's work around which means we won't be able to test the deployment until we we put it on the Data Center's Test Server.  But it keeps us from spinning our wheels and lets us get on with development.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now