测试好用的Webservice Json WCF 发布用到配置文件备用

本文详细介绍了如何配置WebserviceJsonWCF发布服务所需的配置文件。内容包括连接字符串设置、服务模型配置、绑定和行为设定等关键步骤,旨在帮助读者快速掌握并正确配置WCF服务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


测试好用的Webservice Json WCF 发布用到配置文件备用,避免遗忘,整整琢磨了一个星期!

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <connectionStrings>
      <add name="ConnectionString" connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=########;Integrated Security=True" />
    </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <client>
      <endpoint address="http://localhost:8733/Niewei.Enterprise.OPCServer.wcfservice/OPCServerService/"
        binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IOPCServerService"
        contract="MyOPCServerService.IOPCServerService" name="WSHttpBinding_IOPCServerService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IOPCServerService" />
      </wsHttpBinding>
      <webHttpBinding>
        <binding name="NewBinding0" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
          maxReceivedMessageSize="2147483647" transferMode="Streamed">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" />
          <security mode="None" />
        </binding>
      </webHttpBinding>
    </bindings>
    <behaviors>

      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="httpBehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <services>
      <service name="AndroidWebServer.MainService">
        <endpoint address="" behaviorConfiguration="httpBehavior" binding="webHttpBinding"
          bindingConfiguration="NewBinding0" contract="AndroidWebServer.IMainService" />
      </service>
    </services>
  </system.serviceModel>
  
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值