It was the web.config not having the full service.svc in the path....
405 Error upon moving MVC 4 application and WCF service to IIS 8
-
25-09-2022 - |
Domanda
Previously a MVC 4 application was hosted in windows 2003 server asp.net 4.0.30319
and the WCF Service was hosted there as well.
Anonymous access was checked along with IUSR_ account
and the checkbox for Integrated Windows Authentication.
Now Upon moving the Website and Service both to Windows 2012 Server ( IIS 8 ) Hitting the Webservice works fine:
http://exampleservicetest.test.com/Service.svc?wsdl
Problem: Pulling up the website which calls the service returns a 405 error put below. Tampering with settings per google is not fixing the issue....
Error.
An error occurred while processing your request.
ProtocolException
System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (405) Method Not Allowed. ---> System.Net.WebException: The remote server returned an error: (405) Method Not Allowed.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---
Soluzione 2
Altri suggerimenti
It looks like it is a common configuration issue. This is an HTTP Transport status error which normally means that you tried to make an Http Request using an HTTP method that is not supported by the web server. That said, you need to have a look at how your website is requesting this service, what http method it is using...GET
, POST
, PUT
, DELETE
, HEAD
,etc. and determine whether your web server supports this method.
Common causes are:
- The web method that the service exposes doesn't support this Http Method. This is not your case
- Your has WebDav Publishing installed and it is enabled for your website
- If you need
WebDav
then check your settings to enable the required permissions as described in this Blog Post (noticed that it's related to IIS7.5 but you can find some documentations about how to do the same in IIS8 in the IIS Website) - If you disable
WebDav
you might need to also disable the related module and handler in yourweb.config
file
- If you need
If you are using extensionless
REST
urls and you are usingPUT
andDELETE
methods then you might need to configure theapplicationhost.config
file to support these http methods by modifying theverb
property of theExtensionless-Url
handler element.<add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />