1

I am trying to consume asmx web service in other WCF service based application. This WCF service application has multiple projects where actual service is in one project (which has web.config file) and other library projects. I am trying to consume asmx web service In one of these library projects(which will have app.config file) by adding service reference for some reason.I have properly copied endpoint section with binding details properly to web.config file of wcf service project which is the Main or startup project.

I am not facing any issues while adding asmx service as web reference to actual WCF app and I am able to run wcf service & consume asmx service with out any issues.

I also verified asmx service by adding it as service reference or web reference in a small test wcf service similar to actual wcf application and I am not facing any issues in consuming there as well.

But I am facing below issues while adding asmx service by service reference,

1)I could see below exception inside proxy object for channel and inner channel after creation of proxy instance as below

var client = new CC.WebServices.Proxy.Test.PSP.TestService.TestServiceSoapClient()

Channel = 'srv.Channel' threw an exception of type 'System.ServiceModel.CommunicationObjectFaultedException'

InnerChannel = 'srv.InnerChannel' threw an exception of type 'System.ServiceModel.CommunicationObjectFaultedException'

2)And below statement where I am just trying to add timeout is throwing exception with below mentioned message in catch block

client.InnerChannel.OperationTimeout = new TimeSpan(0, 5, 0);

"The communication object, System.ServiceModel.ChannelFactory`1[CC.WebServices.Proxy.Test.PSP.TestService.TestServiceSoap], cannot be used for communication because it is in the Faulted state."}

3)I am trying to call asmx service method but getting above exception before reaching this call.

value = client.GetTestDetails(requestdata);

Basically My actual WCF service application projects are using different dotnet framework versions. Like Main WCF project is using .net f/w 4.6 version where as the project which is consuming asmx service is using .net f/w 4.0 .But I verified this as well in my test wcf service app where there is no issue even with different .net f/w versions for different projects.

Can you please help me in fixing this issue ?

  • This line of code `var client = new CC.WebServices...TestServiceSoapClient()` expects a default config for the service to be present in you app/web.config file. Is that config present and is it valid? – HasaniH Feb 10 '21 at 16:33
  • Yes default config is autogenerated in app.config file of project where asmx service proxy is created.and I added client section and binding section of this app.config to web.config in root WCF project – Raghunath Machineni Feb 11 '21 at 04:46
  • Maybe this link will help you:https://stackoverflow.com/questions/2763592/the-communication-object-system-servicemodel-channels-servicechannel-cannot-be – Theobald Du Feb 22 '21 at 09:51

0 Answers0