我有一个 WCF 服务,它与 SQL 服务器连接并获取一些数据,构造对象然后返回它。我使用简单的绑定,.NET 4.0,当您创建 WCF 服务时,我没有添加任何特殊设置,只是模板中的默认设置。
该服务在我的本地数据库上运行良好,但现在当我部署在服务器上时,我检查了时间,处理需要 7 微秒(第一个需要更多时间)但在到达开始处理之前,WCF每次需要3 秒在点击第一行代码之前请求,我找不到原因。
<endpoint address="http://localhost/Service.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService" contract="Local.IService"
name="BasicHttpBinding_IService" />
谢谢!
服务行为:
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false 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="true" />
绑定:
<bindings>
<basicHttpBinding>
<binding name="BasicBinding" maxReceivedMessageSize="10485760" />
</basicHttpBinding>
</bindings>