I have a WCF service that saves the client to the database, and it works as expected in Internet Explorer , but not in Chrome (for this reason I will not leave HTML / Json, as this makes me think that this is a web configuration problem but I can post it if someone likes).
In Chrome, I get an error:
Failed to load the resource: the server responded with a status of 405 (method not allowed) Subscriber.htm: 1 XMLHttpRequest cannot load http://example.com/MyService.svc/SaveCustomer . Invalid HTTP Status Code 405
My web configuration:
<system.web> <compilation debug="false" strict="false" explicit="true" targetFramework="4.0" /> <pages> <namespaces> <add namespace="System.Runtime.Serialization" /> <add namespace="System.ServiceModel" /> <add namespace="System.ServiceModel.Web" /> </namespaces> </pages> </system.web> <system.serviceModel> <services> <service name="IService.MyService"> <endpoint address="http://example.com/MyService.svc" binding="webHttpBinding" bindingConfiguration="" contract="IService" behaviorConfiguration="webHttpBinding" /> </service> </services> <client> <endpoint binding="webHttpBinding" bindingConfiguration="" address="http://example.com/MyService.svc" contract="IService" /> </client> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="webHttpBinding"> <webHttp/> </behavior> </endpointBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="false" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"> <remove name="WebDAVModule" /> </modules> <handlers> <remove name="WebDAV" /> <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /> <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /> <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*" /> <add name="Access-Control-Allow-Headers" value="Content-Type, Authorization, Accept, X-Requested-With" /> <add name="Access-Control-Allow-Methods" value="OPTIONS, TRACE, GET, HEAD, POST, PUT" /> </customHeaders> </httpProtocol> </system.webServer>
So, I read several articles and added the appropriate sections, removing WebDav, but nothing seems to have changed.