image

將web應用程式發佈到Azure App Server,開啟網站顯示錯誤訊息"錯誤。處理您的要求時發生錯誤。",經確認為存取權限問題。當在Azure建立SQL Server時,有將開發平台的ip設定為允許存取,所以在開發平台可以正常執行APP,當程式發佈到Azure App Server,因Azure SQL Server未將Azure App Server預設為安全規則,所以才會發生存取錯誤。

具體操作過程如下

  讓錯誤訊息顯示在網站上,在程式內的web.config加入<customErrors mode="Off" />。

 

  重新開啟網站顯示錯誤訊息為無法存取SQL Server

Cannot open server 'xxxxxxx' requested by the login. Client with IP address '40.74.253.179' is not allowed to access the server.  To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range.  It may take up to five minutes for this change to take effect.

image

  在Azure SQL Server的安全性網路設定,將"允許 Azure 服務和資源存取此伺服器"的選項勾選,重新開啟網站恢復正常。

 

image

 

 

arrow
arrow
    全站熱搜

    門外漢 發表在 痞客邦 留言(0) 人氣()