Answer the question
In order to leave comments, you need to log in
How to run methods of one WCF service from another?
Just started learning about WCF services.
The essence of the task is as follows:
There is a site that must access the methods of an already existing service - A, but it cannot do this directly.
To do this, you need to create an intermediary service - B, whose methods - just have to run the methods of service A and return the result to the site.
I started by adding a link to the wsdl file of service A to the project where service B will be located.
Then I created a new service by adding a new svc file and an interface to the project that describes all its methods.
Then I added a link to service A in the new service and in the constructor of the new service I create an instance of its client (in order to access its methods through it)
When I try to start this new service, I get an error about a name conflict
Perhaps I initially approached the task completely wrong and do not understand the essence of WCF, I would be glad if you tell me in which direction to move.
Answer the question
In order to leave comments, you need to log in
if I'm not mistaken, you need to pass the endpoint string to the constructor, otherwise the service will not start. I myself did not create services, but I have experience of connecting to the mvc project. when connecting to a project, a block like this is created in the web.config file:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="TubeServiceSoap" maxBufferSize="" maxReceivedMessageSize="" sendTimeout="00:05:00" />
</basicHttpBinding>
<customBinding>
<binding name="TubeServiceSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="путь к сервису" binding="basicHttpBinding" bindingConfiguration="TubeServiceSoap" contract="TubeServiceSlezhLVL2.TubeServiceSoap" name="TubeServiceSoap" />
<endpoint address="путь к сервису" binding="customBinding" bindingConfiguration="TubeServiceSoap12" contract="TubeServiceSlezhLVL2.TubeServiceSoap" name="TubeServiceSoap12" />
</client>
</system.serviceModel>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question