如何使用静态IP地址配置WCF?

时间:2016-07-26 09:31:36

标签: c# wcf

我有一台安装了IIS的Windows Server 2012。 我想将我的WCF公开给这个IIS, 我不知道如何使用静态IP地址配置web.config文件。 我在互联网上搜索过,但没有结果与我匹配。

这是我的web.config文件:

<?xml version="1.0"?>
    <configuration>
      <system.web>
        <compilation debug="true" targetFramework="4.0" />
      </system.web>
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="basicHttp" allowCookies="true" maxReceivedMessageSize="20000000"  maxBufferSize="20000000" maxBufferPoolSize="20000000">
              <readerQuotas maxDepth="32"  maxArrayLength="200000000"  maxStringContentLength="200000000"/>
            </binding>
          </basicHttpBinding>
        </bindings>
        <services>
          <service name="MyService.BService">

            <endpoint address="http://192.168.11.197/MyService/BService.svc" binding="basicHttpBinding"
              bindingConfiguration="" contract="MyService.IBService" />
          </service>

        </services>
        <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>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="false" />
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>

    </configuration>

0 个答案:

没有答案