Rikus_Trent
asked on
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.
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.
how the service, web service hosted ? their uRLS...how you are accessing them ?
ASKER
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.
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
});
ASKER
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.
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.
please paste complete error and can we see ur endpoint configuration and how you are invoking your service please ?
ASKER
Here's the error information:
Exception Type:
System.ServiceModel.Endpoi ntNotFound Exception
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.Channe ls.HttpCha nnelUtilit ies.Proces sGetRespon seWebExcep tion(WebEx ception webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channe ls.HttpCha nnelFactor y.HttpRequ estChannel .HttpChann elRequest. WaitForRep ly(TimeSpa n timeout)
at System.ServiceModel.Channe ls.Request Channel.Re quest(Mess age message, TimeSpan timeout)
at System.ServiceModel.Dispat cher.Reque stChannelB inder.Requ est(Messag e message, TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca ll(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca ll(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channe ls.Service ChannelPro xy.InvokeS ervice(IMe thodCallMe ssage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channe ls.Service ChannelPro xy.Invoke( IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr oxies.Real Proxy.Hand leReturnMe ssage(IMes sage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Pr oxies.Real Proxy.Priv ateInvoke( MessageDat a& msgData, Int32 type)
at AirportInfoService.Airport InfoSoap.G etAirports (GetAirpor tsRequest request)
at AirportInfoService.Airport InfoSoapCl ient.Airpo rtInfoServ ice.Airpor tInfoSoap. GetAirport s(GetAirpo rtsRequest request)
at AirportInfoService.Airport InfoSoapCl ient.GetAi rports()
at UIControlPopulation.GetSta tions(Stri ng prefixText, Int32 count)
at SyncInvokeGetStations(Obje ct , Object[] , Object[] )
at System.ServiceModel.Dispat cher.SyncM ethodInvok er.Invoke( Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispat cher.Dispa tchOperati onRuntime. InvokeBegi n(MessageR pc& rpc)
at System.ServiceModel.Dispat cher.Immut ableDispat chRuntime. ProcessMes sage5(Mess ageRpc& rpc)
at System.ServiceModel.Dispat cher.Immut ableDispat chRuntime. ProcessMes sage4(Mess ageRpc& rpc)
at System.ServiceModel.Dispat cher.Immut ableDispat chRuntime. ProcessMes sage3(Mess ageRpc& rpc)
at System.ServiceModel.Dispat cher.Immut ableDispat chRuntime. ProcessMes sage2(Mess ageRpc& rpc)
at System.ServiceModel.Dispat cher.Immut ableDispat chRuntime. ProcessMes sage1(Mess ageRpc& rpc)
at System.ServiceModel.Dispat cher.Messa geRpc.Proc ess(Boolea n 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="St rongWildca rd"
maxBufferSize="32768000" maxBufferPoolSize="524288" maxReceivedMessageSize="32 768000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="81 92" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="163 84" />
<security mode="None">
<transport clientCredentialType="None " proxyCredentialType="None"
realm="" />
<message clientCredentialType="User Name" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://mySite/theService.asmx"
binding="basicHttpBinding" bindingConfiguration="Airp ortInfoSoa p"
contract="AirportInfoServi ce.Airport InfoSoap" name="AirportInfoSoap" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="SOAPBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="UIControlPopulationB ehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFa ults="fals e"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="UIC ontrolPopu lationBeha vior" name="UIControlPopulation" >
<endpoint address="" binding="webHttpBinding" contract="IUIControlPopula tion" behaviorConfiguration="SOA PBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchang e"/>
</service>
</services>
</system.serviceModel>
I am using the VS2008 generated client objects for the asmx service within the wcf service:
AirportInfoService.Airport InfoSoapCl ient airportInfoClient = new AirportInfoService.Airport InfoSoapCl ient();
_stations = new List<AirportInfoService.Ai rport>(air portInfoCl ient.GetAi rports());
I am calling the WCF service from the clientside control as mentioned above.
Exception Type:
System.ServiceModel.Endpoi
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.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Dispat
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr
at System.Runtime.Remoting.Pr
at AirportInfoService.Airport
at AirportInfoService.Airport
at AirportInfoService.Airport
at UIControlPopulation.GetSta
at SyncInvokeGetStations(Obje
at System.ServiceModel.Dispat
at System.ServiceModel.Dispat
at System.ServiceModel.Dispat
at System.ServiceModel.Dispat
at System.ServiceModel.Dispat
at System.ServiceModel.Dispat
at System.ServiceModel.Dispat
at System.ServiceModel.Dispat
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"
maxBufferSize="32768000" maxBufferPoolSize="524288"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="81
maxBytesPerRead="4096" maxNameTableCharCount="163
<security mode="None">
<transport clientCredentialType="None
realm="" />
<message clientCredentialType="User
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://mySite/theService.asmx"
binding="basicHttpBinding"
contract="AirportInfoServi
</client>
<behaviors>
<endpointBehaviors>
<behavior name="SOAPBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="UIControlPopulationB
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFa
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="UIC
<endpoint address="" binding="webHttpBinding" contract="IUIControlPopula
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchang
</service>
</services>
</system.serviceModel>
I am using the VS2008 generated client objects for the asmx service within the wcf service:
AirportInfoService.Airport
_stations = new List<AirportInfoService.Ai
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.
Looks like your giving .asmx instead of .svc URL in the config.
ASKER
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.
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 ?
Can you also give the separate configurations for the service in server and on client please ?
ASKER
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).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.