I'm trying to setup the MVC development enviroment on my laptop. I'm running WinXP Pro with IIS 5.1
I got the environment setup with the sample MVC application that come with beta. I can only get to the home page. when i try to open About us page. i run into the page can not be found error. Is it the routing not set in the Global.asax?
Your issue is that IIS 5/6 don't play nice with routes without extensions, the home page is resolving because its pointing to default.aspx,
In a nutshell, do this:
If *.mvc extension is not registered to the hosting , it will give 404 exception. The working way of hosting MVC apps in that case is to modify global.asax routing caluse in the following way.
routes.Add(new Route("{controller}.mvc.aspx/{action}",
new MvcRouteHandler())
{ Defaults = new RouteValueDictionary (new{ controller = "YourController"} ) });
In this way all your controller request will end up in *.mvc.aspx, which is recognized by your hosting. And as the MVC dlls are copied into your local bin , no special setttings need to be done for it.
See this question for lots of good information:
ASP.NET MVC and IIS 5
You may go to your IIS site's properties, tab "Home directory", press "Configuration...", select ".aspx", press "Insert...", Type "c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll", uncheck check box and press "Ok". This heplped me.
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
Related
I am having a problem setting up a website under IIS 7. I have created an application and the application pool for the application. Application pool is using .Net Framework 4.0 as my .net app is written in .Net Framework 4.0. Application pool is set to use classic Pipeline Mode. MIME Types have been automatically added to .asp & .aspx.
When I run the website windows explorer is showing me "View Downloads" and trying to download "application name localhost" when it downloads the file I notice that its the html of my default.aspx. I have checked Default Document and it contains Default.aspx.
If I remove .asp & .aspx MIME Types then I get an error: HTTP Error 404.17 - Not Found The requested content appears to be script and will not be served by the static file handler.
I have seen this problem many times. IIS is not serving aspx pages and most likely is not running for the entire server or that site.
For the entire server: Check to see if iis world wide web service is running.
For the site alone: Hit run inside IIS.
You can easily know if IIS is running properly by going to IIS and hit the browse option from inside a web site.
With the data you have put these are the things I would try in order if I were you:
Check in Server Manager/ Features if ASP.NET is installed (ServerManager/Roles/Web Server(IIS) look for ASP.NET
Check IIS Manager if everything is ok by:
Try to browse a test.html file to see if you are able to browse normal
Check Basic settings by clicking Test Settings
Check Handler Mappings to see if aspx is there.
Try to browse a sample test.aspx page with test data.
Check Application pool settings.
Reinstall Framework 4.0
Reboot machine ( a classical)
If you gave us more info and/or the ouput of my proposed tests maybe can help more. Good Luck :)
I had the 404.17 error happening on a server today. As you and cad mentioned, I checked the framework of the Application Pool that my site was using to make sure it was set to ASP.Net 4.0, and it was. What happened in my case is that my site was not using the application pool that I thought it was. My site was nested under another site, meaning my site pointed to a subfolder but another site was pointing to the root folder. Even though I had my site set to use the ASP.Net 4.0 Application Pool, the root site used a different Pool that had ASP.Net turned off, it was set to "No managed code". When I set the framework to 4.0 for the Pool the parent site was using, then my site started working.
In my case the solution was fixing the Handler mappings as explained here: http://forums.iis.net/post/1943489.aspx
IIS Manager->high-light you web site->click Handler Mappings icon on
the home pane->click Revert to Parent...
on the right Actions pane
I have an ASP.NET Web Application project that I am using to host a WCF Data Services (OData) project.
I went and changed the url from:
http://localhost/MyProject
to
http://localhost/v1/MyProject
after I did that I created a Virtual Directory for the new project URL.
Now when I run I get this error:
Unable to start debugging on the web server. The web server is not configured correctly. See help for common configuration errors. Running the web page outside of the debugger may provide further information.
I clicked help but it was no help (was IIS 6 level instructions, I have IIS 7). I did some googling and it was all fairly generic responses.
How can I get this working again? (Aside from revert to my old Url. Reverting works but I changed it for a very good reason.)
Your virtual directory need to point to the same scr directory you were originally debugging against.
Also, make sure the virtual directory is configured for Windows Authentication, which is required for debugging.
I had to go to my website in IIS and add a folder under it called v1. After I did that it all worked perfectly.
I just created a simple test WebService with Asp.net called
MyWebService.asmx
I can't access it from exteriour, cause Visual Studio don't allow this..
So I wanted to make a own IIS Webserver to host my Webservice, but
how do I add my "MyWebService.asmx" to the IIS with the IIS-Manager?
Hope someone can help me.. Google didnt help me a lot
You have to publish this WebService (right click on the project -> Publish) and host it using IIS like a regular Web Application.
Just create a new application, as you would do if you create a "real" ASP application
put, for completeness and to be sure the app is running a default.aspx into the root dir, which says something like "app is running!"
put the ASMX file into the directory (i think it will be place in the APP_CODE directory, but i'm not sure 100%)
config your webservice in the global.asax, without it nothing will happen (hint: also configure the help page for webservices, otherwise users accessing it will get the interface description in the browser)
A longer description of that can be found here: http://msdn.microsoft.com/en-us/library/8wbhsy70%28v=vs.80%29.aspx
So I've set up IIS 7.5 to host my ASP.NET MVC website on my own local machine, but when I surf to http://localhost/ I just get this:
Welcome to ASP.NET MVC!
To learn more about ASP.NET MVC visit
http://asp.net/mvc.
A very basic HTML page with only this on it. No CSS or anything.
I haven't used IIS before, so I don't know what settings I need to change in order for this to work, but this is what I've done:
Added a new Site "MySite"
Set the Physical path to the root folder of my asp.net project
Tested the settings (everything OK)
Edited the "MySite" Application Pool and set it to .NET framework version v4.0.30319
What else do I need to do to make my website display? Thanks.
EDIT: please read this
I'll give a step-by-step walkthrough of what exactly I do:
1) I create a new ASP.NET MVC3 Razor web project. I don't do anyting but save and build the project.
2) I open IIS Manager
3) I go to Sites -> Add Web Site
4) I fill in following data:
Site Name: MyWebSite
Application Pool: MyWebSite
Physical Path: Visual Studio 2010\Projects\MyOwnProject\MyOwnProject (Project root folder)
Connect as: My PC's login and password. Test Settings is succesful
I leave the rest of the settings as it is and press OK
5) I go the Application Pools and edit the basic settings of MyWebSite to change the .NET framework to the latest version (v4.0.30319)
6) I select MyWebSite and click Browse *:80 (http) to go the web site. It opens up Chrome and I see the following page:
<h2>Welcome to ASP.NET MVC!</h2>
<p>
To learn more about ASP.NET MVC visit http://asp.net/mvc.
</p>
That's it. Nothing more. What am I missing here?
That looks like it is working (at least that's an MVC page it is displaying.) Maybe you need to alter your default route in Global.asax.cs to hit a different controller?
Do you have a Layout.cshtml in your shared folder and is your ViewStart pointing to it?
Edit:
I do remember having an issue like this at one point. I think it has to do with static resources pointing to the root which by default will be pointing to another App in IIS. I'm not sure if this is exactly the issue but what I do is setup an address in my host file for each application. For me the host file is :
C:\Windows\System32\drivers\etc\hosts
You have to run notepad or something as Administrator to edit it and add the following line:
127.0.0.1 MySite
This will allow you to simply navigate to http://mysite without any conflicts. Just double check your IIS setting so that the hostfile address point to the right physical path.
It seems I've fixed it, I don't know how or why this works. But this is what I've done:
In Visual Studio, I went to the Properties of my project. There, in the Web tab, I selected "Use local IIS Web Server", filled in "http://localhost/MyWebSite" and hit "Create Virtual Folder".
Save and build the project and suddenly it worked. However, I am not able to debug my project from Visual Studio now. But when I change the Web configuration back to "Use Visual Studio Development Server" it still works and I can debug again...
Doesn't make too much sense because you should be able to debug from IIS right?
We configured IIS 5 by mappping * to asp.net handler so that ASP.NET MVC works. After configuring this, directory browsing is not working.
Also uploadify jquery plugin is not working. Showing IO error 2038.
Can someone please suggest us how to enable directory browsig with ASP.NET MVC configurations on IIS 5?
I don't think that you'll be able to get directory browsing to work with ASP.NET MVC in the same application. When you added the wildcard mapping, you told ASP to handle every request. If the request doesn't map to an actual file, it will try to match a route in MVC. If there isn't a matching controller with an index (assuming that's your default) action, then it will fail.
My suggestion is to split your web site into "application" and "content". Set up the application as a separate web site and apply the wildcard mapping there. Leave your content with the original configuration. I don't use IIS5 any more -- with one exception on an old XP development box -- I'm afraid that can't really be of more help.
If I were you, though, I'd upgrade to a more recent OS and web server. Expecting new technology to work on a decade-old platform is very optimistic.