none
The remote server returned an unexpected response: (405) Method Not Allowed. RRS feed

  • Question

  • Hi ,

    I have created WCF application and hosted in the remote server IIS as https.

    I have added this service as reference in windows application and able select the view the methods inside the service.

    Problem is when i access the methods in the windows application I get the error as follows,

    "The remote server returned an unexpected response: (405) Method Not Allowed."

    Please guide me on this ASAP.

    Monday, October 6, 2014 4:07 PM

All replies

  • Hi M.shan,

    For this situation, about the error message, which may indicate that it occurs if ASP.NET is not installed or the .svc file type is not mapped to the aspnet_isapi.dll.

    To correct this you must make sure that aspnet_isapi is enabled as a Web service extension for IIS. You can view and modify this setting using IIS Manager, or by running aspnet_regiis –i –enable from the .NET Framework installation directory. Once you have done so, verify that ASP.NET is running. To do so, place a test .aspx file in the \inetpub\wwwroot directory, and make sure it can be browsed with a browser.

    For more detailed information, you could refer to:

    http://msdn.microsoft.com/en-us/library/vstudio/ms752252(v=vs.90).aspx

    http://stackoverflow.com/questions/18004206/protocolexception-unhandled-405-method-not-allowed-with-wcf-bindings-and-endp

    Regards

    • Marked as answer by M.shan Tuesday, October 7, 2014 10:07 AM
    • Unmarked as answer by M.shan Tuesday, October 7, 2014 10:08 AM
    Tuesday, October 7, 2014 5:43 AM
    Moderator
  • Hi ,

    Thanks for your reply

    I checked with all the options which you have given, but I get the same error "The remote server returned an unexpected response: (405) Method Not Allowed."

    I have added Managed Handler & Script Map in the IIS and installed the HTTP activation, but the result is same.

    Also I executed following step,

    1.register ASP.NET runtime from VS.NET 2005/2008 command line run: aspnet_regiis –i –enable

    2. map *.svc file by
    2.1 Win2003 or XP run: "%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r
    2.2 Win2008 or Vista run: "%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -L
    3. then restart your IIS  iisreset /noforce

    After these steps I got following error message,

    "Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly"

    For this issue I applied the steps as per this link, 

    http://msdn.microsoft.com/en-us/library/hh169179(v=nav.71).aspx

    After applying these steps, I again got the "The remote server returned an unexpected response: (405) Method Not Allowed" again.

    I have been checking this issue for more number of days. Resolved suggestion will be great.

    Please guide me on this ASAP. Thanks in advance.



    • Edited by M.shan Tuesday, October 7, 2014 10:07 AM
    Tuesday, October 7, 2014 10:04 AM
  • Hi ,

    Please help me on the above query ASAP. Awaiting for reply.

    Thursday, October 9, 2014 4:56 AM
  • Hi,

    There might be many reasons for this error, and for the current circumstance, you could get more information from the following links:

    http://blogs.msdn.com/b/knom/archive/2009/10/14/iis7-wcf-services-svc-do-not-work.aspx

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/110e4703-e7a5-4676-b54b-5f187f057706/405-method-not-allowed-when-calling-method-of-wcf-service?forum=wcf

    And about host the service in IIS:

    http://blogs.msdn.com/b/amitlale/archive/2007/05/21/hosting-wcf-service-in-iis.aspx

    Besides, you could post the corresponding server config file here so that we could make a further research.

    Regards

    Thursday, October 9, 2014 6:00 AM
    Moderator
  • Hi ,

    I have checked with the above 3 links and applied the solution but still same error getting as "The remote server returned an unexpected response: (405) Method Not Allowed".

    I have attached my web config code block below,

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.web>
            <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
    	<customErrors mode="Off" />
        </system.web>
      <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="TransportSecurity" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
              <security mode="Transport">
                <message clientCredentialType="Certificate" />
                <transport clientCredentialType="None" />
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
        <services>
          <!-- This section is optional with the default configuration introduced
             in .NET Framework 4. -->
          <service name="InStoreService.LicenseCheck">
            <endpoint address="Service URL" binding="wsHttpBinding" bindingConfiguration="TransportSecurity" contract="InStoreService.IService_DB">
            <identity>
    	   <dns value="DOmain name" />
    	</identity>
    	</endpoint>
            <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior>      
    	<useRequestHeadersForMetadataAddress />
              <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
              <serviceMetadata httpsGetEnabled="true" />
              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="false"  />
     <standardEndpoints>
        <webScriptEndpoint>
          <standardEndpoint name="" crossDomainScriptAccessEnabled="true"/>
        </webScriptEndpoint>
      </standardEndpoints>
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
            <directoryBrowse enabled="true" />
            <handlers>
                <remove name="svc-Integrated" />
                <add name="svc-Integrated" path="*.svc" verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv2.0" />
            </handlers>
      </system.webServer>
    </configuration>
    
    Please let me know if I have made any mistakes in the above config details .

    Awaiting for your reply ASAP. Thanks in advance.

    FYI, I am using HTTPS binding.

    Monday, October 13, 2014 7:23 AM
  • Hi ,

    Please review above web config file ASAP and let me know any issues with config file.

    Awaiting for reply.

    Wednesday, October 15, 2014 9:33 AM