Azure SQL Database Connectivity Issues - Too many connections?

前端 未结 3 1034
终归单人心
终归单人心 2021-02-13 05:05

I have a site which is a white label (Multiple versions of the same site) which I\'ve launched recently. There isn\'t a great deal of traffic yet - mainly bots but probably 800

3条回答
  •  余生分开走
    2021-02-13 05:50

    A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)

    and

    System.ComponentModel.Win32Exception: An existing connection was forcibly closed by the remote host

    can both be safely ignored. They occur whenever a connection is interrupted externally, which can happen if the user closes the browser in the middle of receiving a response, or if other network issues break the connection. There are other similar exceptions probably due to different framework code being active when that condition is detected. These exceptions are thrown to stop processing of the request because the caller isn't listening anymore anyway.

    If you want to track the number of active requests, you should create a wrapper that you use for all SQL connections, do an interlocked increment and decrement while the connection is in use (use IDisposable), and keep track of the high-water-mark for that value. You could report it in a special hidden or admin page. This way, even if you can't get into the system when the problem occurs, you could see what the highest number of active connections was to be sure it wasn't your issue. This could also help you discover if you're not disposing of all of your connections.

提交回复
热议问题