【发布时间】:2015-07-11 00:23:20
【问题描述】:
这是我第一次使用 Azure,但遇到了问题。
我的 MVC 项目中有一个注册和登录脚本,它在我的本地计算机上运行良好,但是当我尝试使用 Azure 时,我在“处理您的请求时发生错误”页面上收到此消息。
我已在防火墙中允许该 IP。 我已将数据库与网站链接。
该项目使用代码优先模型。当我尝试注册时,它将在数据库中创建表,但不会输入用户数据。所以我只剩下一张空桌子。
此外,当我尝试从 Sql management studio 部署我的数据库时,它会创建表但无法输入数据。
我做错了什么?
编辑:
所以当我尝试从 SQL Management Studio 部署我的数据库时,这是我在导入数据库时遇到的错误
TITLE: Microsoft SQL Server Management Studio
------------------------------
Could not import package.
Warning SQL0: A project which specifies SQL Server 2012 as the target platform may experience compatibility issues with SQL Azure.
Error SQL72014: .Net SqlClient Data Provider: Msg 40511, Level 15, State 1, Line 2 Built-in function 'newsequentialid' is not supported in this version of SQL Server.
Error SQL72045: Script execution error. The executed script:
ALTER TABLE [dbo].[Domains]
ADD DEFAULT (newsequentialid()) FOR [DomainId];
(Microsoft.SqlServer.Dac)
我认为这是由于我的模型使用了 GUID。这可能是导致 Azure 上的数据库出现所有这些问题的原因吗?
【问题讨论】:
-
当您尝试插入或创建某些内容时,您会收到什么错误消息?
-
显示一些代码,雅各布。
-
我不确定要向您展示什么代码,因为我刚刚意识到任何需要数据库进行用户登录或其他原因的页面都会导致
An error occurred while processing your request.。一切都可以在本地运行,但不能在 Azure 上运行。 -
只需谷歌搜索“newsequentialid azure”就会提示您应该为您的
DomainId列切换到uniqueidentifier/newid()。
标签: c# sql asp.net-mvc azure azure-sql-database