我有大約15-20個服務 - 每個服務都有自己的合同和實現文件。我想在控制檯應用程序中託管所有這些服務,以便在開發過程中更易於調試。控制檯中的主機WCF服務應用程序
項目結構
- 服務 - 解決方案
- ServiceContracts - 項目
- 實施 - 項目
- 的ServiceHost - Windows服務項目 - 已經就位,工作細..
- ServiceConsoleHost - 項目 - 目前正在開展工作。
我有一個app.config
文件在這裏ServiceConsoleHost項目從配置文件中的示例文本...
<service name="TestpricingService" behaviorConfiguration="HostBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/testService/pricingService"/>
</baseAddresses>
</host>
<!-- use base address provided by host -->
<endpoint address="net.tcp://localhost:820/testService/pricingService"
binding="netTcpBinding"
bindingConfiguration="HostBinding"
contract="Test.Services.Contracts.IpricingService" />
<!-- the mex endpoint is exposed at http://localhost:8000/testService/purchasing/mex -->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
<behaviors>
<serviceBehaviors>
<behavior name="HostBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
<behavior name="PooledHostBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
<ObjectPoolingServiceBehavior minPoolSize="0" maxPoolSize="5" idleTimeOut="30000"/>
</behavior>
</serviceBehaviors>
</behaviors>
在此先感謝...
問題是什麼? – Rajesh 2012-02-13 16:32:49
需要代碼來在控制檯應用程序中駐留這些服務 - 在循環中。 – venky 2012-02-13 16:40:14
「循環」是什麼意思?同樣在你的app.config中,你有一個net.tcp綁定和一個mexhttpbinding,你的服務名稱不完全合格。 – Rajesh 2012-02-13 16:41:08