Sql-Server

伺服器之間的連接問題 - 應用程序 (IIS) - SQL Server

  • October 14, 2021

我創建了一個從 SQL 伺服器檢索大量數據的 Web 應用程序 (ASP.NET Core MVC)。該應用程序安裝在具有 IIS 6.2 和 Windows Server 2012R2 的伺服器 (A) 中,而 SQL 伺服器安裝在具有 MS SQL Server 2014 和 Windows Server 2012R2 的另一台伺服器 (B) 中。

在伺服器A安裝此應用程序時,檢索大量數據返回錯誤:

502 - Web server received an invalid response while acting as a gateway or proxy server.
There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.

當應用程序在我自己的電腦上執行並連接到伺服器 B 的 SQL 時,沒有返回錯誤並且任務成功完成。

是超時還是優先級錯誤?伺服器 A 和伺服器 B 的事件查看器均未返回錯誤。是伺服器 A 的配置(IIS 還是其他)?

注意:伺服器中的其他應用程序正常執行。

注意:應用程序的日誌有以下類型的消息:

warn: Microsoft.EntityFrameworkCore.Query[20500]
The LINQ expression 'where {from String q in __8__locals1_Geobricks_2 where [l].Geobrick.StartsWith([q]) select [q] => Any()}' could not be translated and will be evaluated locally.

通過優化 SQL 查詢解決了這個問題。

我設法縮短了從 SQL 伺服器檢索到的數據,其中包含以前未包含在送出給 SQL 伺服器的 SQL 命令中的 WHERE 子句。

我沒有嘗試,但可能我可以將命令超時設置為更大的時間……

引用自:https://serverfault.com/questions/1080530