I am attempting to automate translation jobs within workflow from Web 8.5. I have based my code on the top answer to this question.
I am creating a SessionAwareTmServiceClient within the workflow extension code, using the following code:
SessionAwareTmServiceClient tmClient = new SessionAwareTmServiceClient("TmBinaryEndpoint");
When this code runs I receive the following error output:
018-07-17 17:39:13,898 [13] ERROR Project.Workflow.BaseActivity - System.InvalidOperationException: Could not find endpoint element with name ‘TmBinaryEndpoint’ and contract ‘Tridion.TranslationManager.V2.TmService.Client.ISessionAwareTmService’ in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.
I have the endpoint configured as per this and this, in the %TRIDION_HOME%\web\WebUI\WebRoot\Web.config file.
<system.serviceModel>
.
.
.
<bindings>
.
.
.
<netTcpBinding>
<binding name="EclNetTcpBinding" maxReceivedMessageSize="2147483647" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647"/>
</binding>
<binding name="TmNetTcpBinding" maxReceivedMessageSize="2147483647" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647"/>
</binding>
</netTcpBinding>
</bindings>
.
.
.
<client>
<endpoint name="EclBinaryEndpoint" address="net.tcp://localhost:2660/ExternalContentLibrary/2012/netTcp" binding="netTcpBinding" bindingConfiguration="EclNetTcpBinding" contract="Tridion.ExternalContentLibrary.Service.Client.ISessionAwareEclService"/>
<endpoint name="TmBinaryEndpoint" address="net.tcp://localhost:2660/TranslationManager/V2/netTcp" binding="netTcpBinding" bindingConfiguration="TmNetTcpBinding" contract="Tridion.TranslationManager.V2.TmService.Client.ISessionAwareTmService"/>
</client>
.
.
.
</system.serviceModel>
These configs were there by default, I did not modify them. I do not know why my code cannot find this config file, does anyone have any insight into this?
SOLUTION
Based on the answer from Saurabh Gangwar below I found the following:
1) %TRIDION_HOME%\web\WebUI\WebRoot\Web.config is the wrong config file, the correct config file is %TRIDION_HOME%\bin\TcmWorkflowAgent.exe.Config
2) The %TRIDION_HOME%\web\WebUI\WebRoot\Web.config file has the endpoint:
<endpoint name="TmBinaryEndpoint" address="net.tcp://localhost:2660/TranslationManager/V2/netTcp" binding="netTcpBinding" bindingConfiguration="TmNetTcpBinding" contract="Tridion.TranslationManager.V2.TmService.Client.ISessionAwareTmService"/>
The %TRIDION_HOME%\bin\TcmWorkflowAgent.exe.Config file has 2 endpoints:
<endpoint name="TmBinaryEndpoint" address="net.tcp://localhost:2660/TranslationManager/V1/netTcp" binding="netTcpBinding" bindingConfiguration="TmNetTcpBinding" contract="Tridion.TranslationManager.V1.TmService.Client.ISessionAwareTmService"/>
and
<endpoint name="TmBinaryEndpointV2" address="net.tcp://localhost:2660/TranslationManager/V2/netTcp" binding="netTcpBinding" bindingConfiguration="TmNetTcpBinding" contract="Tridion.TranslationManager.V2.TmService.Client.ISessionAwareTmService"/>
The "TmBinaryEndpoint" in the Web.config is configured to the correct V2 contract, while in the TcmWorkflowAgent.exe.Config the "TmBinaryEndpointV2" is configured to the correct endpoint. I have changed my code to reflect this:
SessionAwareTmServiceClient tmClient = new SessionAwareTmServiceClient("TmBinaryEndpointV2");