web exception when calling an .asmx webs service from within a wcf service

I have a local wcf web service in my website that calls an asmx sesrvice from another website (this site exists on the same server).

When my website calls my local service it receives a web exception. A 400 bad request message. The stack trace points to the call to the .asmx webmethod. I have tried calling my wcf service from a local win forms app and I receive a protocol exception : The remote server returned an unexpected response: (405) Method Not Allowed.

I have tried adding a clientaccesspolicy.xml file to both sites root folders with no success.

The website also has a restful json wcf service that does not call another service that runs just fine.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

how the service, web service hosted ? their uRLS...how you are accessing them ?
Rikus_TrentAuthor Commented:
The wcf services are hosted as part of the website in IIS6.  http://mysite/services/service1.svc

The asmx service is at a different site. In the website project I've added a web reference to it, and then used the proxy class within the svc service.

The website uses the microsoft ajax library to call the svc service from the client as seen in the code window below.

I currently have the whole thing running successfully on a test server calling the asmx service from the same production location. The only difference I can see between my test and production environment is that the production has each site in its own root folder, where my test has all the sites as virtual folders under the default website.
        minimumPrefixLength: 1,
        serviceMethod: 'GetStations',
        servicePath: 'services/UIControlPopulation.svc',
        enableCaching: true,
        completionSetCount: 10,
        completionInterval: 250

Open in new window

Rikus_TrentAuthor Commented:
Issue update:

I have change from using a WEB REFERENCE in the wcf service to adding the asmx service as a SERVICE REFERENCE and using that in the wcf service.

I am now receiving a EndpointNotFoundError: There was no endpoint listening at http://mySite/theService.asmx that could accept the message.

I have browsed to this address in a browser without issue. And still it works from my test server, but not my production server.
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

please paste complete error and can we see ur endpoint configuration and how you are invoking your service please ?
Rikus_TrentAuthor Commented:
Here's the error information:

Exception Type:

There was no endpoint listening at http://mySite/theService.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.


Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at AirportInfoService.AirportInfoSoap.GetAirports(GetAirportsRequest request)
at AirportInfoService.AirportInfoSoapClient.AirportInfoService.AirportInfoSoap.GetAirports(GetAirportsRequest request)
at AirportInfoService.AirportInfoSoapClient.GetAirports()
at UIControlPopulation.GetStations(String prefixText, Int32 count)
at SyncInvokeGetStations(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

InnerException: System.Net.WebException
InnerException Message: The remote server returned an error: (400) Bad Request.

    <binding name="AirportInfoSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
     receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
     bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
     maxBufferSize="32768000" maxBufferPoolSize="524288" maxReceivedMessageSize="32768000"
     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
      maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     <security mode="None">
      <transport clientCredentialType="None" proxyCredentialType="None"
       realm="" />
      <message clientCredentialType="UserName" algorithmSuite="Default" />
   <endpoint address="http://mySite/theService.asmx"
    binding="basicHttpBinding" bindingConfiguration="AirportInfoSoap"
    contract="AirportInfoService.AirportInfoSoap" name="AirportInfoSoap" />
            <behavior name="SOAPBehavior">
            <behavior name="UIControlPopulationBehavior">
                  <serviceMetadata httpGetEnabled="true"/>
                  <serviceDebug includeExceptionDetailInFaults="false"/>
      <service behaviorConfiguration="UIControlPopulationBehavior" name="UIControlPopulation">
            <endpoint address="" binding="webHttpBinding" contract="IUIControlPopulation" behaviorConfiguration="SOAPBehavior"/>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

I am using the VS2008 generated client objects for the asmx service within the wcf service:

AirportInfoService.AirportInfoSoapClient airportInfoClient = new AirportInfoService.AirportInfoSoapClient();
_stations = new List<AirportInfoService.Airport>(airportInfoClient.GetAirports());

I am calling the WCF service from the clientside control as mentioned above.
The endpoint address "http://mySite/theService.asmx" has web methods or "Operation contracts" ?

Looks like your giving .asmx instead of .svc URL in the config.
Rikus_TrentAuthor Commented:
That's correct. The client endpoint is pointing to an asmx web service (Web Methods). The local scv service is calling the asmx service.

We have several asmx web services deployed using either web references or service references depending on the project and all function correctly. I have tried using both a service reference and a web reference for this asmx service with similar results (works on my test server, but not production). The service reference  gives me the above error and the web reference only gives me a 400 bad request message with no other info.
The above configuration contains for both server and client configurations? have you merged it or is it only for client or server ?

Can you also give the separate configurations for the service in server and on client please ?
Rikus_TrentAuthor Commented:
Thats it for the service configuration... It has the server configurations for .svc service (UIControlPopulation) which acts as a client of the asmx service (AirportInfoSoap).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.