I created and deployed a WCF client (launched from a VSTO Word Addin) on a Win2008R2 Terminal Server.
When excution the default constructor of the WCF proxy an InvalidOperationException is thrown, stating that the default endpoint for the contract cannot be found.
The same WCF client when deployed to a Win7 x64 machine just runs fine using the same .dll.config
I tried to create an instance inside PowerShell and receive the same error.
If creating a dedicate endpoint in PowerShell I can excute a service method:
$binding = New-Object System.ServiceModel.BasicHttpBinding
$endpoint = New-Object System.ServiceModel.EndPointAddress("http://myserver:7777/CompanyService.svc")
$client = New-Object MyClient.CompanyServiceReference.CompanyServiceClient($binding, $endpoint)
$v = $client.Version()
Service Web.config (part)
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="NoHttpSecurity" sendTimeout="00:03:00">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="CompanyService">
<endpoint address="http://myserver:7777/mex" contract="IMetadataExchange" binding="mexHttpBinding" />
<endpoint name="Version" address="http://myserver:7777/Version" contract="MyService.ICompanyService" binding="basicHttpBinding" bindingConfiguration="NoHttpSecurity" />
<endpoint name="CompanyList" address="http://myserver:7777/CompanyList" contract="MyService.ICompanyService" binding="basicHttpBinding" bindingConfiguration="NoHttpSecurity" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
MyClient.dll.config (part)
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ICompanyService" closeTimeout="00:01:00">
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://myserver:7777/CompanyService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICompanyService"
contract="CompanyServiceReference.ICompanyService" name="BasicHttpBinding_ICompanyService" />
</client>
</system.serviceModel>
UPDATE
I “fixed” this by copying my Client.config to the Office Program Folder and renaming it to WINWORD.EXE.config.
Can you create an endpoint programmatically?
If this works, then very probably it is a configuration issue.