I have IIS8 (complete, not Express) on Win8. I'm trying to make the PUT verb to work on IIS. In fact, my question would be exactly this: ASP.NET Web API - PUT & DELETE Verbs Not Allowed - IIS 8
However, the highest voted answer (provided by the asker himself) doesn't help me because I just don't have the "ExtensionlessUrl-Integrated-4.0" handler. It is simply missing, along with a host of other handlers, that I've have seen in screenshots from similar posts. My only three handlers (that show up on the Handler Mappings dialog of IIS management console at the server level) are: OPTIONSVerbHandler TRACEVerbHandler and StaticFile.
However much I've tried to find a way to add the "ExtensionlessUrl-Integrated-4.0" handler, I've been unable to do it. I tried even to copy into %systemroot%\System32\inetsrv\config\
applicationHost.config the <add> element (within <handlers>) that the author of the referenced post used to solve the problem: <add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />. But to no avail.
I know this is a very noob question (I'm new to IIS), but just have not been able to find an answer in the documentation. May I get a hand, pls?
Related
I have an ASP.NET MVC 4 application running under IIS 8.5. My previous understanding/experience of these scenarios in MVC is that if a static file exists, it will be served. If it doesn't exist, the path will be sent through MVC routing. This is the desired behaviour, but doesn't seem to be happening.
By default if I create a catchall route at /blah.html and no corresponding static file, IIS serves up a 404 (courtesy of the StaticFile handler). The MVC route is never hit. If the file exists, it is served.
So, I did some Googling and chatting to colleagues and came up with the answer as posted here:
https://stackoverflow.com/a/14327897/1043198
In goes the handler:
<add name="ApiURIs-ISAPI-Integrated-4.0" path="*" type="System.Web.Handlers.TransferRequestHandler" verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" preCondition="integratedMode,runtimeVersionv4.0" />
Great! The request now hits the MVC app and my dynamic content is served as expected. Except now, when I put a physical file in place, I get an error again. An uninformative 500 error with the following information (and nothing else):
Module: ManagedPipelineHandler
Notification: ExecuteRequestHandler
Handler: ApiURIs-ISAPI-Integrated-4.0
Error Code: 0x800703e9
What's going on? Why does IIS not fall back to my MVC app when static files don't exist and how come when I fix that, the inverse occurs and static files are no longer served properly? I'm fairly sure this has always been default behaviour in the past.
App pool is running in Integrated mode, CLR v4.0.
After finding various answers and blog posts suggesting enabling runAllManagedModulesForAllRequests, it seems that this - while it works - isn't the right approach.
RAMMFAR does exactly what it says on the tin and runs all requests (including those for "unmanaged" static resources) through all managed modules, which has a performance overhead and can also cause unusual side-effects depending on the modules enabled and the requests run through them.
Turns out the only module required to solve this problem is the UrlRoutingModule which, when the precondition is removed, causes all static resources to be run through MVC routing (when no static file exists):
<remove name="UrlRoutingModule" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule"
preCondition="" />
In a typical SignalR view it includes...
<script src="/signalr/hubs"></script>
I'm trying to get my head around SignalR and want to look at the javascript within this folder. But I cant find it within my project.
Also, I understand this contains javascript that is generated customised for my hub class etc. Is this correct?
The /signalr/hubs file is dynamically created by the SignalR server when the app boots up. Since the SignalR server hangs off of the /signalr endpoint it then generates the /hubs ontop of it.
Here's how SignalR 2.0.2 generates the file at a high level: https://github.com/SignalR/SignalR/blob/2.0.2/src/Microsoft.AspNet.SignalR.Core/Hubs/DefaultJavaScriptProxyGenerator.cs .
And here's where it determines that the request is to /signalr/hubs (in 2.0.2) https://github.com/SignalR/SignalR/blob/2.0.2/src/Microsoft.AspNet.SignalR.Core/Hubs/HubDispatcher.cs#L235-L253
Finally to answer your last question, it absolutely does. This is why it's dynamically generated. If you'd ever like to get a physical file that represents the /signalr/hubs endpoint you can follow the instructions here: http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-javascript-client#manualproxy
Hope this helps!
You are correct. It's dynamically generated so that's why you can't see it in visual studio. Enable directory browsing in your web.config by adding
<system.webServer>
<directoryBrowse enabled="true"/>
</system.webServer>
You can then navigate to localhost/signalr/hubs to see the file contents.
All of a sudden I'm getting an error as follows in Visual Studio:
Error 113 Section or group name 'security' is already defined. Updates to this may only occur at the configuration level where it is defined. myProject\web.config
Here is the section that it is complaining about:-
<sectionGroup name="elmah">
<section name="security" requirePermission="true" type="Elmah.SecuritySectionHandler, Elmah" >
Needless to say the security section only occurs once.
It's like it's checking a cached version of the file somewhere or something.
I had a very similar issue here recently:
Elmah.MVC working under IIS Express but not IIS 7.5
However the solution there does not appear to be working here
OK it turns out this was related to setting MVCBuildViews to true...
Which seemed like a reasonable think to want to do but seems to cause these issues.
I'd be interested still to know a better solution that would allow me to continue to use this flag.
Can anyone shed any light on this? I feel like I have wasted the entire day today hunting and searching the internet for any scrap of information about how to do this. I have created a very simple WCF RESTful service. It is basically a proof of concept. I have a simple database behind it and I am just trying to get it working so that I can view, create, update and delete items. Right now I only have view and update working. I'll tackle create later. For now I can't figure out why the delete doesn't work. Almost everything I have found so far tells me that I need to disable the WebDAV module. I did that and then I got PUT to work. But I can not get DELETE to work. Whenever I attempt to call DELETE through my service I get the following error:
The remote server returned an unexpected response: (405) Method Not Allowed.
So it seems like somewhere on my server it is not allowing the DELETE verb. But for the life of me I can not figure it out. I already checked the Handler Mappings and the handler allows all verbs for the .SVC extension. I have disabled WebDAV. I'm not really sure where else to look. I am using IIS 7.5 on Windows Server 2008 R2.
(I can provide code if it would help at all)
Thanks,
Corey
In case anyone having the same issue.
Here is another way you can try.
in web.config
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
</handlers>
</system.webServer>
I just spent a ton of time trying to figure out why I kept getting 405 Method Not Allowed when using the DELETE verb. Everything I read said to uninstall WebDAV from IIS, but that seemed to break IIS in that all sites gave 503 errors. I reinstalled it, then went about looking in IIS for some setting.
It turns out that WebDAV is the problem, and it has a node on the IIS features page named "WebDAV Authoring". Clicking on that lets you then click on WebDAV Settings... to get the properties page. In the section Request Filtering Behavior, set Allow Verb Filtering to False seemed to do the trick for me (YMMV).
This seemed to be a popular result when googling for a solution, so I thought I'd add to the list of suggested solutions.
Open your website's Handler Mappings in IIS Manager
Edit each handler you want to DELETE with, clicking Request Restrictions, choosing the Verbs tab, then add DELETE to the "One of the following" list or, if appropriate within your concerns, allow all verbs.
You might need to restart your website and/or recompile your code
Well I'm not sure if this is really an answer to my question but it did solve the problem. I simply started a new project in Visual Studio and this time I used the .NET REST Service template that I found online. Then I transferred the old code I had from my previous attempt and used it in the new project. It worked like a charm. All four verbs work correctly now (GET, PUT, POST and DELETE). So it is working now.
Corey
It seems the world is awash with people having problems deploying RIA WCF services, and now I'm one too. I've already tried a bunch of things, but to no avail. I need WCF RIA to support a Silverlight 3 application I've built.
The short story is, using the new WCF RIA services (Nov 09?) I open VS 2008, create new project (silverlight application), enabling ".NET RIA services". Add new item to web project - Linq2SQL dbml file (from SQL 2005 DB prepared earlier) and compile. I add a new item to the web project - domain service (link the tables I need) and compiled. Using the domain context I "Load" data with a standard RIA get query in the MainPage and add a TextBlock to display returned data. Build & run (cassini) - success. Using VS to publish to IIS on local PC - success.
Using VS to publish to test server (IIS6) - browse to location and the Silverlight app loads but Fiddler tells me I've got a 404 on all the the WCF .svc requests. Use Fiddler to "launch IE" on the service request and it's true - 404.
I have already run aspnet_regiis, ServiceModelReg and added mime types for .xap, .xaml, .xbap and .svc. I have included the System.Web.Ria and System.Web.DomainServices DLL with copy local true.
I need help with either
a) a solution
b) an approach to find a solution
I had some troubles with this also, although once I figured them out it's relatively straight forward.
First, run through http://timheuer.com/blog/archive/2009/12/10/tips-to-deploy-ria-services-troubleshoot.aspx (although it seems you have most of that covered off).
Check that you have your DomainServiceModule in the web.config in the new system.webServer bit and the old bit for IIS6:
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="DomainServiceModule" type="System.Web.Ria.Services.DomainServiceHttpModule, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
Finally, I had to create my services manually, by creating .svc files where SL is looking for them (from fiddler) and filling them in with:
<%# ServiceHost Service="NameOfSerice" Factory="System.Web.Ria.DomainServiceHostFactoryEx" %>
Make sure that you also visit the .svc file directly (without the /binary on the end) as you can get some nice errors there (well once you solve your 404 of course!)
HTH,
Jordan.
I fought this issue for a little while myself where it could not find the .svc file. I soon realized it wasn't just my .svc, it was all .svc files. It then appeared to be an IIS6 issue. It turns out that the ASP.NET v4.0x Web Service Extensions are set to "Prohibited" by default. Went into Web Service Extensions config and set ASP.NET v4.0x to "Allowed" and life was all good.
I ran into the same problem. Worked fine with the cassini server under Windows 7. Deployed to Windows Server 2008 R2 with IIS7, and it would not work. Fiddler reported that an 'EndPointNotFoundException' was being thrown.
My solution, since I have full control of the server, was to install Visual Studio 2008 Express, Silverlight 3 SDK, and the WCF RIA Services Beta for VS2008. This meant that the necessary DLLs were already installed in the GAC. I don't think this affected the result, but I turned off 'Copy Local' for the RIA DLLs that were referenced by the Web app.
Probably an unorthodox solution, but it worked for me!!! Actually, I did this at the suggestion of Microsoft Support.
By the way, support for this through Microsoft is very sparse at this time. They are actually trying to figure out right now internally who is going to support this technology: WCF team or Silverlight team. I know it's still in beta, but be warned that a 'GoLive' license doesn't mean its fully supported. I had someone from the WCF team who went out of his way to help me on this, but gave me a disclaimer several times during the call, that it wasn't really supported through those channels yet.
If someone is interested, how to deploy a complete Silverlight solution to IIS with your own batch script, read my answer in this post:
Is there a Management Service (WMSVC) UI in IIS 7 on Windows 7?
I did this, because there was no way, the in-bulit webdeploy feature of VS 2010 was working. The batch script makes it possible, that you can run and debug on IIS.
I know, this is not the explicit answer to this question, but it is a very similar question.
I think you would only use FactoryEx if you extended the Factory as described here. Also, according to my help files, the full name is System.Web.Ria.Services.DomainServiceHostFactory, but the parser can't create that type either, although I have System.Web.Ria in the GAC.
I agree - deploying WCF RIA over https is a challenge - I have yet to get it to work.