サービスを IIS7 でホストし、有効なプロトコルとして net.tcp を使用しています。IIS からサービスを参照すると、サービス ページとその tcp アドレスが表示されますが、そのアドレスを WCF テスト クライアントまたは任意のアプリケーションでサービス参照として使用すると、 wcf クライアントでこのエラーを取得します
Error: Cannot obtain Metadata from http://localhost:808/MyService/MyService.svc?wsdl
If this is a Windows (R) Communication Foundation service to which you have access,
please check that you have enabled metadata publishing at the specified address.
For help enabling metadata publishing,
please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455
WS-Metadata Exchange Error
URI: http://localhost:808//MyService/MyService.svc?wsdl
Metadata contains a reference that cannot be resolved:
'http:/localhost:808/MyService/MyService.svc?wsdl .
There was no endpoint listening at
'http:/localhost:808/MyService/MyService.svc?wsdl that could accept the message.
This is often caused by an incorrect address or SOAP action. See InnerException,
if present, for more details.
The remote server returned an error: (404) Not Found.HTTP GET Error
URI: http:/localhost:808/MyService/MyService.svc?wsdl
The HTML document does not contain Web service discovery information.
wcf クライアントに net.tcp アドレスを入力すると、エラーが http のみに関するものであることに驚きました。
私のサービス構成は
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime maxRequestLength="102400" />
</system.web>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="TcpBinding" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
closeTimeout="10:00:00" sendTimeout="10:00:00" openTimeout="10:00:00"
receiveTimeout="10:00:00"
maxReceivedMessageSize="2147483647" portSharingEnabled="true" >
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None"/>
<reliableSession enabled="true" inactivityTimeout="10:00:00" />
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="MyService.MyServiceBehaviour"
name="MyService.MyService">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="TcpBinding"
name="EndPointTCP" contract="MyService.IMyService" isSystemEndpoint="false" />
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyService.MyServiceBehaviour">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension, LongDate"
/>
</system.webServer>
</configuration>