Entity Framework : “The underlying provider failed on Open”

前端 未结 6 928
天涯浪人
天涯浪人 2021-02-13 00:14

When I try to insert a record, I get this error : The underlying provider failed on Open. This error occurs only with IIS and not with VWD 2008\'s webserver. In the EventViewer

6条回答
  •  臣服心动
    2021-02-13 00:56

    Using new instance of DB Entity on every action should not physically create connection to your SQL server. Entity Framework will use connection pool created for your (process, app domain, connection string) as configured in your connection string to avoid creating new connections.

    This issue is very environmental and tweaking parameters (in your conn string) like below should resolve the problem-

    Min Pool Size=1;

    Max Pool Size=100; // default

    Connect Timeout=15; // in seconds

    Pooling=true;

提交回复
热议问题