【发布时间】:2012-12-07 18:54:36
【问题描述】:
我有一个 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>
【问题讨论】:
-
您的“ServiceBehavior”属性是什么样的?请张贴。
-
对不起,我指的是类上的 ServiceBehavior 属性。
-
我在类上没有任何 ServiceBehavior 属性
-
您如何托管您的 WCF 服务,它是自托管还是在 IIS 上?另外,您是否分析了您的数据库查找代码?
标签: wcf wcf-binding wcf-client