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 ?