wcf ホスティングを Windows サービスから IIS でホストされるように変更しています。
ソリューションにwcf Service Applictionを追加し、プロジェクトへの参照を追加し、svcファイルをこれに編集しました
<%@ ServiceHost Language="C#" Debug="true"
Service="EFG.Acc.CashService.ServiceFactory.CashService" %>
web.config
次に、netTcp バインディングとエンドポイントになるバインディングを構成および定義しました。
IIS Web サイトの設定を有効にして、http.nettcp へのプロトコルを有効にし、同じ例外を有効にしました。
service.svc ファイルを参照しているときに、次の例外が発生しました。
**protocol 'net.tcp' is not supported.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The protocol 'net.tcp' is not supported.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: The protocol 'net.tcp' is not supported.]
System.ServiceModel.Activation.HostedTransportConfigurationManager.InternalGetConfiguration(String scheme) +98668
System.ServiceModel.Activation.HostedAspNetEnvironment.GetBaseUri(String transportScheme, Uri listenUri) +24
System.ServiceModel.Channels.TransportChannelListener.OnOpening() +12200164
System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +274
System.ServiceModel.Channels.DelegatingChannelListener`1.OnOpen(TimeSpan timeout) +112
System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +318
System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout) +72**
そして、これが私のWeb.configファイルです
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding"
transactionFlow="true"
listenBacklog="100"
maxConnections="5000"/>
</netTcpBinding>
</bindings>
<services>
<service name="EFG.Acc.CashService.ServiceFactory.CashService">
<endpoint address="net.tcp://localhost:8000" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding" name="netTcpEndPoint" bindingName="CashServiceTCP"
contract="EFG.Acc.CashService.Contracts.Interfaces.ICashService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:7000"/>
</baseAddresses>
</host>
</service>
</services>
<protocolMapping>
<add scheme="net.tcp" binding="netTcpBinding" bindingConfiguration="NetTcpBinding"/>
</protocolMapping>
<behaviors>
<serviceBehaviors>
<behavior>
<!--To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment-->
<serviceMetadata httpGetEnabled="true"/>
<!--To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information-->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<client>
<endpoint address="net.tcp://localhost:8000/CashService" binding="netTcpBinding" bindingConfiguration="NetTcpBinding" contract="EFG.Acc.CashService.Contracts.Interfaces.ICashService" name="CashServiceTCP2" />
</client>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>