Link to home
Start Free TrialLog in
Avatar of srussell705
srussell705

asked on

WCF IIS6 VS2008 (405) Method Not Allowed error

I have an inhouse WCF / ASP.NET page combination.  in my unit tests my method called works fine.  When i call same method from ASP.NET with same data, i get this error:
The remote server returned an error: (405) Method Not Allowed.

[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
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1546

I can see from Line # 30 that my button click passes the params back to the WCF service.  Then these 2 lines are trying to deal with it:
 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +7605567
   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +257

I am expectin bool back.

What have i missed in either a configuration of IIS  or some other space?

TIA

__Stephen

Avatar of 60MXG
60MXG

I think it is your IIS setting!

open the IIS Manager and navigate to the virtual folder which you are using.
Then right-click and select properties.
Then, on the Virtual Directory tab, change the "Execute Permissions" to script and execute

Make sure the Directory folder allow users to execute too!
The best way to trouble shoot is to compare your development server's set up and production server's set up side by side so you know it is identical.
Avatar of srussell705

ASKER

Thanks but that change did not change the situation.  

any other ideas?
try to restart your iis afterward or refresh your browser (if that's web app) by holding Shift + F5 key to flush the cache.
Check the folder security?  Sometime the folders set to view only so you need to make sure the folders allow execution.  For an example, I have my code loaded in d:\Inetpub\wwwroot\qualityAssurance\ , I will navigate to the folder and click on the selected folder and select "Property" then click on "Security" Tab and check your "Permissions for Users".   Make sure the "Read & Execute" is selected for the users or SYSTEM.  Hope I am pointing you to the right direction.
in advanced security settings the Name = SYSTEM was given Full Control for all folders in project.  Read and Execute is set as yes, or you could only hit the NO as an option.


I have stopped the IIS and restarted it as well.

Check the actual files?  I had experience once that somehow the folders and all sub-folders have Read and Execute permission but when I check the actual file, it only has read permission.  Maybe change the timeout setting???
ASKER CERTIFIED SOLUTION
Avatar of 60MXG
60MXG

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well i had a stupid brain fart here.  

seems that path in Test harness had the folder referenced and what i needed in the web config was the straight url pathing instead.