相关疑难解决方法(0)

在Azure上运行MVC4时出错

我们有时会在Azure上启动MVC4站点时出错.从未在本地服务器上看到这些错误.在将数据库和应用程序部署到Azure之后,如果请求授权并且在站点上不活动一段时间之后(由于超时可能导致错误),则会在主页启动时出现问题.代码简单如下所示:

[InitializeSimpleMembership]
[Authorize(Roles = "Administrator")]
public class HomeController : Controller
{
    public ActionResult Index()
    {
        return View();
    }
}
Run Code Online (Sandbox Code Playgroud)

请求主页有时会失败:

[Win32Exception (0x80004005): Access is denied]

[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL …
Run Code Online (Sandbox Code Playgroud)

sql-server asp.net-mvc azure asp.net-mvc-4 azure-sql-database

1
推荐指数
1
解决办法
1340
查看次数