【发布时间】:2014-09-11 05:48:14
【问题描述】:
在 Azure 上将我的 MVC5 应用程序作为 Web 角色发布后,它无法访问。 Fiddler 向我展示了根 url 请求的 504 结果。 RDP 可以访问 Web 角色的实例(目前是单个实例)。默认配置的端点。
为了检查应用程序是否启动,我在 Global.asax 文件“开始”方法的末尾放置了“throw new Exception(“XXXXXX”)”,然后它会在浏览器中返回一条错误消息。
在我看来,路由配置不起作用。 Routiong 是 MVC 的默认值
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
对于本地机器上的 azure 模拟器,一切正常。 有什么建议?或者可能有人有同样的问题?
现在我肯定知道数据库连接中的错误。
错误是下一个
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.Data.SqlClient.SqlException:建立与 SQL Server 的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接。 (提供者:SQL 网络接口,错误:26 - 错误定位服务器/指定的实例)
来源错误:
第 97 行:public IEnumerable GetRecentShapes(int count) 第 98 行:{ 第 99 行:返回 Context.RShapes.Where(s => s.CreationStatus == (int)ECreationStatus.Published).OrderByDescending(s => s.UploadTime).Take(count).ToList(); 第 100 行:} 第 101 行:
源文件:d:\4_Projects\REPOSITORY\3D\3Dweb\Core\Repository.cs 行:99
堆栈跟踪:
[SqlException (0x80131904):建立与 SQL Server 的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接。 (提供者:SQL 网络接口,错误:26 - 错误定位服务器/指定的实例)]
我发现的关于这个问题的所有信息 - 如果连接字符串不正确,就会发生这种情况。不过是对的,我查过了。
【问题讨论】:
标签: c# asp.net azure asp.net-mvc-5