Windows服务端点命名和配置

时间:2014-04-14 20:28:24

标签: c# wcf windows-services config

我似乎无法弄清楚如何更改C#Windows服务的默认端点。你需要在那里有一些路径以及服务名称吗?没有任何错误和服务运行,但我无法导航到该服务。当我使用项目的默认路径时,它可以正常工作。

这是我的app.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="ClientSettingsProvider.ServiceUri" value="" />
    <add key="baseAddress" value="http://192.168.1.23:8733/GPService/" />
  </appSettings>

  <system.web>
    <compilation debug="true" />
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
      <providers>
        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e34" serviceUri="" />
      </providers>
    </membership>
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
      <providers>
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e34" serviceUri="" cacheTimeout="86400" />
      </providers>
    </roleManager>
  </system.web>

  <!-- When deploying the service library project, the content of the config file must be added to the host's 
    app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="GPWebService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
          <security mode="Message">
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>

    <client>
      <endpoint address="http://TestServer:48620/Dynamics/GPService/GPService" binding="wsHttpBinding" bindingConfiguration="GPWebService" contract="DynamicsGPService.DynamicsGP" name="GPWebService">
        <identity>
          <userPrincipalName value="user@testdomain.com" />
        </identity>
      </endpoint>
    </client>

    <services>
      <service name="WcfGPServiceLibrary.GPService">
        <host>
          <baseAddresses>
            <add baseAddress="http://192.168.1.23:8733/GPService/" />
          </baseAddresses>
        </host>
        <endpoint address="" 
                  binding="wsHttpBinding" 
                  contract="WcfGPServiceLibrary.IGPService">
          <identity>
            <dns value="192.168.1.23" />
          </identity>
        </endpoint>
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, 
            set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="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="True" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

  </system.serviceModel>
</configuration>

0 个答案:

没有答案