每次请求都会使WCF变慢

时间:2012-12-20 09:33:32

标签: wcf wcf-binding wcf-client

我有一个WCF服务,它连接SQL服务器并获取一些数据,构造对象然后返回它。我使用简单绑定,.NET 4.0,在创建WCF服务时,我没有添加任何特殊设置,只是模板中的默认设置。

该服务在我的本地数据库运行正常,但是当我在服务器上部署时,我检查了时间,处理需要7微秒(第一个需要更多)但在到达START处理之前,WCF正在接受<在点击第一行代码之前,每个请求都有b> 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>

1 个答案:

答案 0 :(得分:0)

请求到达IIS和到达C#代码之间发生的主要问题之一是安全检查。根据您的设置,您的开发机器可能没有任何安全性。

假设您正在使用Windows身份验证和NTLM。然后有一个3请求握手,http,401.2,401.1和200响应。在这些请求之间,您的Web服务器将与您的AD服务器通信。

您应该可以通过检查IIS日志来查看这是否是问题。

相关问题