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.
LVL 5
Rikus_TrentAsked:
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.

apeterCommented:
how the service, web service hosted ? their uRLS...how you are accessing them ?
0
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.
$('#ReportStation').autoComplete({
        minimumPrefixLength: 1,
        serviceMethod: 'GetStations',
        servicePath: 'services/UIControlPopulation.svc',
        enableCaching: true,
        completionSetCount: 10,
        completionInterval: 250
    });

Open in new window

0
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.
0
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.

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

Exception Type:
System.ServiceModel.EndpointNotFoundException

Mesasge:
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.

StackTrace:

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.


Configuration:
<system.serviceModel>
            <bindings>
   <basicHttpBinding>
    <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"
     useDefaultWebProxy="true">
     <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" />
     </security>
    </binding>
   </basicHttpBinding>
  </bindings>
  <client>
   <endpoint address="http://mySite/theService.asmx"
    binding="basicHttpBinding" bindingConfiguration="AirportInfoSoap"
    contract="AirportInfoService.AirportInfoSoap" name="AirportInfoSoap" />
  </client>
  <behaviors>
      <endpointBehaviors>
            <behavior name="SOAPBehavior">
                  <enableWebScript/>
            </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
            <behavior name="UIControlPopulationBehavior">
                  <serviceMetadata httpGetEnabled="true"/>
                  <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
      </serviceBehaviors>
  </behaviors>
  <services>
      <service behaviorConfiguration="UIControlPopulationBehavior" name="UIControlPopulation">
            <endpoint address="" binding="webHttpBinding" contract="IUIControlPopulation" behaviorConfiguration="SOAPBehavior"/>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
  </services>
</system.serviceModel>


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.
0
apeterCommented:
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.
0
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.
0
apeterCommented:
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 ?
0
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).
0

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
ASP.NET

From novice to tech pro — start learning today.