none
WCF ASP.NET (405) Method Not Allowed

    Question

  • My test harness calls this method just fine.  But with an ASP.NET call for it??? 

    Exception Details: System.Net.WebException: The remote server returned an error: (405) Method Not Allowed.

    Source Error:

    Line 65: 		public bool PostLogicorXML(String PacklistBarcode, String LPN, Decimal Weight)
    Line 66: {
    Line 67: return base.Channel.PostLogicorXML(PacklistBarcode, LPN, Weight);
    Line 68: }
    Line 69:

    Source File: C:\TFS\Tools\Production Tools\rename-SR\myVPCServiceContracts\Proxies\LogicorShippingServiceClient.cs    Line: 67

    Stack Trace:
    [WebException: The remote server returned an error: (405) Method Not Allowed.] System.Net.HttpWebRequest.GetResponse() +2060853 System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +54 [ProtocolException: The remote server returned an unexpected response: (405) Method Not Allowed.] System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +7605567 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +257 Mimeo.Services.Enterprise.ProductionService.ProductionShippingServiceContract.PostLogicorXML(String PacklistBarcode, String LPN, Decimal Weight) +0 Mimeo.Services.Enterprise.ProductionService.ProductionShippingServiceClient.PostLogicorXML(String PacklistBarcode, String LPN, Decimal Weight) in C:\TFS\Tools\Production Tools\rename-SR\myVPCServiceContracts\Proxies\LogicorShippingServiceClient.cs:67 Mimeo.Tools.ShippingTools.Shippingtools2.Button1_Click(Object sender, EventArgs e) in C:\TFS\Tools\Production Tools\rename-SR\ShippingToolsAJAX\ShippingToolsAJAX\Shippingtools2.aspx.cs:30

    you can see that my button click is passing the values to the WCF. 

    Somehow they are not accepted there.

    this is all in house, so both sides are mine.

    My ASP.NET has the Contract project as part of this solution, per anothers advise. 

    any ideas?  this should not be that tough.
     
    TIA

    __Stephen

    Thursday, July 17, 2008 7:55 PM

Answers

  • Hi,
        Normally, 405 error code is because two reasons;
    1) ASP.NET is not installed or register to your IIS
    2) The *.svc file type is not mapped to the aspnet_isapi.dll

    to solve problem:
    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

    Hope this helps,
    -Jirapong
    Thursday, July 31, 2008 5:04 AM

All replies

  • That usually means your server is not configed correctly.

     

    You can double check to make sure the destination address is intended,  then you can use Inetmgr.exe to make sure the destination application's ScriptMap for .svc have POST verb enabled.

     

    Thursday, July 31, 2008 12:24 AM
  • Hi,
        Normally, 405 error code is because two reasons;
    1) ASP.NET is not installed or register to your IIS
    2) The *.svc file type is not mapped to the aspnet_isapi.dll

    to solve problem:
    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

    Hope this helps,
    -Jirapong
    Thursday, July 31, 2008 5:04 AM
  • Hi

    while i did this step:"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r

    there is an error like this: ServiceModelReg.exe has detected a possible corruption in the IIS metabase that prevents the registration if the ServiceModel IIS scriptmaps.Please either fix the IIS metabase corruption ,or ,if you do not desire ServiceModel WebHost funtionality ,disable the IISAdmin service and reregister ServiceModel .

    "disable the IISAdmin service" ,is it tell me to stop the service of IIS?


     

    Tuesday, April 20, 2010 6:40 AM
  • help link http://stackoverflow.com/questions/368494/wcf-the-request-failed-with-http-status-405-method-not-allowed
    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
    欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
    欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
    Tuesday, April 20, 2010 7:12 AM
  • Hm.. I have this issue with .net 4.0 on ms server 2003  with installed VS 2010.

    How can I register .svc here?

    Tuesday, April 19, 2011 1:20 PM
  • Hi,
        Normally, 405 error code is because two reasons;
    1) ASP.NET is not installed or register to your IIS
    2) The *.svc file type is not mapped to the aspnet_isapi.dll

    to solve problem:
    1.
    <tt> register ASP.NET runtime from VS.NET 2005/2008 command line</tt> run: <tt style="font-weight: bold;">aspnet_regiis –i –enable</tt>
    2. map *.svc file by
    2.1 <tt>Win2003 or XP run: </tt>"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r
    <tt></tt>
    <tt>2.2 Win2008 or Vista run: </tt>"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -L
    3. then restart your IIS  iisreset /noforce

    Hope this helps,
    -Jirapong

    I've tried these three steps and I'm still getting the 405 error.  My WCF service shows me the "You have created a service" message when I navigate to it by browser, but when I try to call a service method from my application, I get the 405 error in an exception.  Can anyone think of anything else to check?
    No spam please.
    Tuesday, May 17, 2011 6:08 PM
  • I am having same problem.

    I have shared web hosting at godaddy.com for both service website and client website.

     

    Please tell me to solve the problem.

    Friday, June 17, 2011 10:38 AM
  • I noticed this issue when I had Fiddler enabled for the http URL proxy. Removing Fiddler setting in the config file may change the error you see...
    .NET Application Developer
    Friday, July 22, 2011 4:35 PM
  • I actually got the same error today when calling a service, that actually worked perfectly before.

     

    And the reason for this was:

    My internet explorer was set to use a proxy (I was playing with that setting today). :)

    When I removed the proxy setting in ie => no errors!

     

     

    Thursday, September 01, 2011 12:24 PM
  • When I do the call from a console test app it works fine.

    I do get this error however when move the call into another wcf/rest service.

    I have obviously got something wrong - using Visual Studio 2010 and .NET 4.  The Webservice I am calling is a 3rd party service that is sitting on a service overseas somewhere.  If I use the test application provided by the developer it works fine.  Calling it from withing another WCF service gives me this error 405.

    Any ideas?

    Monday, February 13, 2012 10:07 PM