Azure和Aspnet_regsql.exe

时间:2012-06-25 17:50:14

标签: asp.net asp.net-mvc-3 azure azure-sql-database

  

可能重复:
  Migrating ASP.NET Membership Database to SQL Azure

我最近向Microsoft Azure发布了一个MVC3应用程序,并且通过一些帮助我能够使我的EF数据库正常工作。但是,我遇到的问题是我使用的默认角色和用户,而不是为管理员登录等创建我自己的表。

我找到了需要你运行Aspnet_regsql.exe的答案,但是我收到了以下错误:

Setup failed.

Exception:
An error occurred during the execution of the SQL file 'InstallCommon.sql'. 
The SQL error number is 40508 and the SqlException message is: USE statement
is not supported to switch between databases. Use a new connection to connect
to a different Database.

我搜索了这个错误,但我发现这不适用于Windows Azure。它引导我阅读这篇文章,这有助于解释原因并提供解决方案:http://thinkfirstcodelater.com/blog/?p=637

它告诉我下载以下文件并运行它们。 http://archive.msdn.microsoft.com/KB2006191/Release/ProjectReleases.aspx?ReleaseId=3539

问题是,当我运行该文件夹中的应用程序时,命令行会出现并消失。我看不出它说的是什么,只是它失败了。我该怎么做才能解决这个问题?

最初的问题源于此:

Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.

当我尝试登录自己的网站时显示。

非常感谢任何帮助。谢谢!

1 个答案:

答案 0 :(得分:0)

您需要适用于SQL Azure的版本,因为错误已经说明,SQL Azure不支持USE语句: KB2006191 - Updated ASP.NET scripts for use with SQL Azure

注意:重复How do i run aspnet_regsql on sql azure?