I was lead to believe that MVC apps were BIN-deployable, so could be deployed to any ASP.net 3.5 compatible server. I'm trying to deploy to a Windows Server 2003 x64 with 3.5 (no SP1) and am having trouble getting it working.
I get the following when hitting the homepage, which redirects to the /Account/LogOn view due to our app config.
The page cannot be found
I've got the three (plus Extensions, I can't remember why) MVC dll's set to Copy Local, so they end up in the bin-folder. I'm publishing and then copying over the app to the server:
System.Web.Abstractions.dll
System.Web.Mvc.dll
System.Web.Routing.dll
System.Web.Extensions.dll
Does anyone know what I'm doing wrong? The app works on another machine we have with 3.5 SP1, and on development machines, also SP1 and with MVC installed.
I've gone over everything I can think of, ensured the permissions are correct, etc.
IIS 6 does not handle .mvc extensions correctly. Among other things you have to map .mvc to the ASP.NET handler. Here is a walkthrough for you: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
Have you set up wildcard mapping on the server that does not work? See "Deploying ASP.NET MVC to IIS 6" for an example. You basically need to map all requests to the ASP.NET ISAPI DLL and tell IIS not to try to verify that the file exists. Don't know if that's your issue, but it has bitten me a few times in deployments.
With IIS6, you can't do extensionless URLs like /Account/LogOn. You have to do something like /Account.aspx/LogOn The ".aspx" can really be almost any arbitrary extension, but you need that extension. Your routes need to take the extension into account as well.
Check to make sure the app pool your site is running under is configured to run ASP .Net 2.0, sometimes it defaults to 1.1 which causes issues similar to yours.
Related
i tried to look around but i did't find a solution.
I have a web space on aruba and i want to publish the default mvc 4 internet website (you know...home, about, contacts).
I tried to publish but it dont't work.
I read about putting .aspx (useless cause no aspx pages here) or .chstml (i tried) on the route config, but nothing happend. Always HTTP Error 403.14
Does anyone tried to publish an mcv 4 website on aruba? What changes do i have to do?
I'm using Windows 2008 Hosting with, with ASP.NET 4 and Classic Pipeline
If you referring to Aruba.it hosting solutions, they doesn't support mvc projects..
Look at there Windows hosting solution
It support asp.net not asp.net mvc...
If they were support it they would have wrote it
If ASP.NET works for you, you can bundle the MVC dll's with your project (so that theres a System.web.mvc.dll in your project's bin folder.
And it should just work.
Aruba supports Mvc4. You just have to remember to publish all the dll as told by Mvison (so mvc dll, sql ce dll, and so on) and also give the write permission to that folder, otherwise they won't allow them to run (think it's a safety policy)
I have a MVC application that works on cassini, works on IIS 6, but I have issues with in IIS 7. I think my issue has to do with how IIS 7 handles threading in a integrated app pool. So to test my theory I'm trying to get my MVC app running in classic mode on IIS 7. I set my app pool to classic and I add a wildcard script for aspnet_isapi.dll. According to all the documentation I've found this is all I should need to do to get MVC running in IIS 7 classic. However when I try and access the web site I get a 404 error. What am I missing?
You need to turn on wildcard script mapping for MVC to work in Classic mode, I think. If not it expects an .aspx file (or similar) to exist for it to handle the execution pipeline over to .NET from IIS.
Find the "Handler mappings" icon on you rsite, and the "Add wildcard Script Map" on the right hand side.
Map it to c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll or whatever version of the framework you are using.
A few things that come to mind right away:
Your web server may not have the ASP.MVC Framework installed, and your web app deployment doesn't include the MVC dll.
The app pool behind your web site isn't running in ASP.NET mode.
Your web bits aren't where you think they are (simple file location misunderstanding)
I have reading posts all night looking for an answer to my issue and haven't found anything that works for me yet. I am sure there is a simple way to do this but I haven't been able to discover it yet.
Details:
MVC 2 Preview
Asp.net 3.5 sp1 framework
VS 2008 C# web application
Windows Server 2008
IIS 7
I have the application running well through VS 2008 no problem. When I hit the play to run in debug mode it starts the ASP.NET Development Server the application loads fine and works as expected, great!
When I publish the application locally or to my web server both on IIS 7 the application doesn't run correctly. Some of the icons are missing and the google maps map is missing. When I view the source it appears correct at first glance, but I can see the paths to the images are looking for the MVC paths and it isn't finding them. It appears the app is running as a regular asp.net app and not an mvc app, maybe?
I also tried to just hit the full source code locally on localhost and the exact same issue is present.
So, I guess my question is how do I deploy a MVC application to run the same in IIS as it does through the development server.
PS The environments are clean and pretty much out of the box.
#user68137 is correct in saying that you need to use relative paths for the images.
I got caught out on this one too, and here's my previous SO question about it...
In short, you need to do something like this...
<img src='<%= Url.Content( "~/Content/Images/banner.jpg" ) %>' alt="Banner" />
Hope this helps!
I had the relative paths set, but what I didn't realize is when I deployed it to the server it went to wwwroot\subsite... I had the relative paths set to src="....\image.jpg" to get back to the root of the site. My error was that if the site is not in the root then the subsite drills back to the root to find the images and of course doesn't find them. Same thing was happening with the JS files. I used the Url.Content and it worked great! problem solved!
The interesting this is when running through the VS dev server with a subsite it still worked well and found the paths even though it shouldn't have. VS dev server <> IIS
Thanks for your help on this!
Simon.
Once you know the virtual path to the location you are deploying the project to, you should go into the project configuration in Visual Studio and add it to your project. This way the visual studio development server will use the same path structure as the deployment server. This will save you countless hours of work when deploying.
When you run your website through Visual Studio, every single request gets processed through the ASP.NET pipeline, including images, CSS and other resources. IIS by default only processes specific extensions (e.g., aspx) unless you tell it otherwise through configuration. Paths like '/content/images/yourimage.jpg' should work just fine...I suspect it's something amiss in your IIS configuration.
Another possibility which I've run into is any custom ISAPI filters you may have installed on the IIS server (e.g., ISAPI_rewrite). It's easy to set up rules in its configuration that lead to some very unexpected results.
I'm struggling to get around the 404 errors from asp.net mvc beta when deploying on IIS 6. I had this working in one of the previews by mapping .mvc in IIS but this no longer works. I've read Omar's post and several others on the web and tried their solutions but no luck so far.
The home page opens without a problem on IIS 6 but others 404 and the site runs well on IIS 7.
Has anybody deployed asp.net mvc beta to IIS 6 with success? If so, what adjustments did you need to make to the code and/or IIS settings to get it to work?
I found a solution to my problem from Steve Sanderson's blog (Thanks Steve):
Use a wildcard mapping for aspnet_isapi.dll. This tells IIS 6 to process all requests using ASP.NET, so routing is always invoked, and there’s no problem. It’s dead easy to set up:
open IIS manager (run -> inetmgr -> OK)
right-click your app, go to Properties
then Home Directory tab, then click Configuration.
Under Wildcard application maps, click Insert (not Add, which is
confusingly just above)
then enter
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll for
“Executable”, and uncheck Verify that file exists.
I can't seem to write comments yet. So I'll write a new answer.
There are a few similar questions going around on stackoverflow.
I'm using MVC 3. I know the question was MVC 2 related. But since this is the first stackoverflow post I bumped in to, I think it's worth mentioning that:
when you use MVC 3, you need to add a new extension mapping with the executable of the .NET 4 framework (C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll)
<edit>I just found out that I even don't need to set up the extension mapping. </edit>
It still didn't work for me then :) I still had to 'Allow' ASP.NET v4.0.30319 in the Web Service Extensions section in IIS:
open IIS
click on the server node
open the Web Service Extensions section
select the ASP.NET v4.0....
right click --> Allow
Good to go!
Url rewriting can help you to solve the problem. I've implemented solution allowing to deploy MVC application at any IIS version even when virtual hosting is used.
http://www.codeproject.com/KB/aspnet/iis-aspnet-url-rewriting.aspx
I am having trouble deploying an ASP.NET MVC app to IIS7.
I have an MVC project created with ASP.NET MVC Beta 1. It consists of nothing more than the default template unmodified.
The app runs just fine within VS2008, but when I publish it to a local IIS7 website (http://localhost), I get the following server error:
The incoming request does not match any route
I have also tried unsuccessfully to access http://localhost/Home/About (a route to a specific page within the template). This returns a 404 error.
I have recreated the website in IIS several times and ensured the pipeline mode is set to integrated. My IIS7 server is running on my Vista Home Premium machine.
I am assuming this is an IIS configuration issue any suggestions as to configuration issues with ASP.NET MVC apps would be appreciated.
Any thoughts?
http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx
This solved all my problems.
Does IIS run ok with the default IIS7 site?
Are you receiving any Event Viewer messages?
Is IIS in Integrated Mode? If it's not, you'll have to do some setup or change it to Integration Mode
Please make sure that you are running under IIS 7.0 Integrated mode. If you need to run it under IIS 7.0 Classic mode, you need to perform several actions to make the routes work. Please refer the following blog posts;
http://www.tugberkugurlu.com/archive/running-asp-net-mvc-under-iis-6-0-and-iis-7-0-classic-mode---solution-to-routing-problem
http://www.tugberkugurlu.com/archive/deployment-of-asp-net-mvc-3-rc-2-application-on-a-shared-hosting-environment-without-begging-the-hosting-company
You need to install these software requirements:
AspNetMVC3ToolsUpdateSetup
wpilauncher_3_10(Select: Application Request Routing 2.5)