asp.net mvc 2 and IIS 6 and json - asp.net-mvc

I have an action: /bikes.json that returns some json (I have it as extension so that compression can be turned on).
While running on MS Visual Studio 2010 it works fine, the /bikes.json call my controller, it dynamically generates the json and returns it.
On IIS6 it does not work, and I get 404s.
How can I get it to work?
(I've tried experimenting with adding a new JSON MIME type, but that has not fixed the problem).
Any help very much appreciated.
Thanks
--MB

In IIS6, you need to map the .json extension to the ASP.NET ISAPI DLL. The problem is that your request isn't even getting to ASP.NET pipeline and ASP.NET MVC>

Related

Can IT Hit WebDAV Lib be used with ASP.NET Web API 2 in the same Project?

I´m currently evaluating Web Dav Product for .NET and I´m really impressed. I only noticed that when I´m integrating the sample code (Asp.NetFileSystem) into my existing ASP.NET Web API 2 Project, it doesn´t work with Office Word directly as a save target.
We have Web API 2 with Windows Authentication and CORS Headers on.
Windows Explorer can open and Navigate the WebDAV Folder and I can create new files there. But when I´m saving from word directly, I get errors in Word that the network path does not work / exist. I tried to debug it but it happens
I separated the WebDAV part in it´s own project for test purposes and it works without the problems.
Am I using it wrong in the context of Web API 2, or is this an unsupported usecase?
I´ll try to get fiddler logs to.
Thanks a lot!
Thanks to the IT Hit WebDav we were able to trace the problem down. To work correctly, OPTION requests have to be processed by the WebDAVHandler. We have a custom module which intercepts OPTION requests to handle CORS. Because of our Module, the WebDAVHandler was not able to add the necessary headers, and Office opened the files readonly.

ASP.NET MVC - Status Codes without HTML

I am developing an ASP.NET MVC 4 project on my local machine using IIS Express using Visual Studio 2010. I have a controller that returns HTTP status codes via HttpStatusCodeResult. I am noticing that IIS Express is returning HTML along with my status code.
I don't want to be lugging around all this extra HTML. Plain HTTP headers is all my JavaScript cares about. Is this something I can shut off in the web.config or is this specific to IIS Express?
I am also curious whether there will be any interaction between my status codes and the customErrors section. If I return a 404, will it redirect to my 404 page? From my tests, it doesn't appear to be an issue, but I want to make sure.

MVC - FilePathResult Not working in IIS6

in my project I have a few actions for specifically returning files (pdf/excel) within my view using FilePathResult. Unfortunately my hosting is currently in IIS6 and while the routing is working by using wildcard mapping for aspnet_isapi.dll the file links simply arent. Is there any way to get these to work with IIS6
Actually, embarassingly enough, the problem was an incorrect path when I moved it to the IIS6 server so it works fine now I've corrected that.

Can MVC run on 3.5 IIS6? NON SP1

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.

trailing slashes on asp.net mvc urls with IIS 7

I'm using asp.net MVC on IIS 7 / windows 2008 server.
The problem is that asp.net mvc generates urls with no slash at the end, like: http://site.com/category/asp. When this url is clicked, IIS 7 probably thinks its a directory and issues a 302 redirect to http://site.com/category/asp/ (with the end slash). How do i change this? I do not want an extra redirect overheat. This does not happen on the Visual Studio web server. Also doesn't happen on nerddinner.com.
You can probably use URL rewriting in IIS7 to help here. Take a look at the article that Scott Hanselman wrote on the issue:
http://www.hanselman.com/blog/ASPNETMVCAndTheNewIIS7RewriteModule.aspx
I think this is not the way, since the web server on Visual Studio doesn't use rewriting and the urls works there with no 302 redirect. Also, i don't think nerddinner.com is using IIS rewrite..
thanks

Resources