WCF和ef 4.0的表现非常糟糕......网站运行速度非常慢

时间:2012-01-23 05:30:10

标签: wcf performance linq entity-framework

我们有一个项目,我们在其中使用了WCF,因为我们有多个站点可以提取相同的数据....我们在WCF和EF 4.0中使用了HTTPBinding来与数据库进行交互。当它被转移到生产环境时环境我们发现该网站非常慢....你知道我们如何能够大幅度提高性能...... EF导致很多性能问题......请建议后续步骤

服务合同

[ServiceContract] 
public interface ICommonService 
{ 
     [OperationContract] 
     LoginDTO AuthenticateUser(string userName, string password, int ownerId); 
}

 <service name="MyService.Services.CommonService">
        <endpoint binding="basicHttpBinding" bindingConfiguration=""
          name="CommonServiceEndpoint" contract="MyService.Services.Contracts.ICommonService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/Design_Time_Addresses/MyService.Services/ICommonService/" />
          </baseAddresses>
        </host>
      </service>

我们引入了索引,但它并没有提高性能

 using (MyService.DataAccess.MyService_RedesignEntities context = new MyService_RedesignEntities())
                {
            context.ContextOptions.ProxyCreationEnabled = false;
                    context.ContextOptions.LazyLoadingEnabled = false;
                    ObjectParameter StrOutput = new ObjectParameter("chvnOutputMesage", SqlDbType.NVarChar);
                    objResult = context.spAuthenticateUser(ownerId, userName, encryptedPassword).FirstOrDefault();     
            return objResult;
        }

0 个答案:

没有答案
相关问题