开发者

App.config in WCF Library and its Windows Service Host

I have two Services called TemplateService, TemplateReportService (both defined in one WCF Service Library) to be exposed to the client application.

And, I am trying to host these services under Windows Service.

Can anyone please guide me if App.config in Windows Service will be same as the one in WCF Library?

Here is my app.config in WCF Library:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <compilation debug="true" />
  </system.web>

  <system.serviceModel>     
    <services>
      <service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
        name="ReportingComponentLibrary.TemplateService">
        <endpoint address="" binding="wsHttpBinding" contract="ReportingComponentLibrary.ITemplateService" >
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" ></endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8080/ReportingComponentLibrary/TemplateService/" />
          </baseAddresses>
        </host>
      </service>

      <service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
        name="ReportingComponentLibrary.TemplateReportService">
        <endpoint address="" binding="wsHttpBinding" contract="ReportingComponentLibrary.ITemplateReportService" >
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8080/ReportingComponentLibrary/TemplateReportService/" />
          </baseAddresses>
        </host>
      </service>

    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="ReportingComponentLibrary.TemplateServiceBehavior">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="True" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </syste开发者_开发问答m.serviceModel>
</configuration>

So, the App.config in my Windows Service(Where I am hosting above two services) will be same as above or there are only some particular sections that I need to move.

Please guide.

Thank you!


First, remove the as we talked about in your other question. Second libraries don't have their own .config files and there is no (built in) way to import certain configuration sections in .NET. So you must consolidate the configuration settings for each library into the single app.config of the Windows service.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜