使用azure移动服务.net后端的成员资格

时间:2015-02-05 14:58:14

标签: azure azure-mobile-services

我正在尝试使用现有代码.net后端构建移动服务。 我使用成员资格来验证用户。 当我将代码上传到azure移动服务时,我收到错误

  

异常= System.UnauthorizedAccessException:访问路径' D:\ Program Files(x86)\ SiteExtensions \ MobileServicesDotNet \ 1.0.447 \ App_Data'被拒绝。      在System.IO .__ Error.WinIOError(Int32 errorCode,String maybeFullPath)      在System.IO.Directory.InternalCreateDirectory(String fullPath,String path,Object dirSecurityObj,Boolean checkHost)      在System.IO.Directory.InternalCreateDirectoryHelper(String path,Boolean checkHost)      在System.IO.Directory.CreateDirectory(String path)      在System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName,String dataDir,String connectionString)      在System.Web.DataAccess.SqlConnectionHelper.EnsureDBFile(String connectionString)      在System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString,Boolean revertImpersonation)      在System.Web.Security.SqlMembershipProvider.GetUserNameByEmail(String email)      在System.Web.Security.Membership.GetUserNameByEmail(String emailToMatch)

但是在我的web配置中(对于我的Web应用程序及其工作是相同的)我定义了数据库连接字符串名称(我也尝试了连接字符串,它也没有用)。

知道如何让azure移动服务与会员合作吗?

我的连接字符串是连接azure sql数据库而不是本地数据库。

感谢

2 个答案:

答案 0 :(得分:1)

为Azure SQL数据库提供有效的连接字符串,而不是(本地)或尝试在App_Data文件夹中创建本地数据库文件的SQLExpress连接字符串。

使用Azure中的任何服务(虚拟机除外)时,使用指向(本地)或SQLExpress实例的默认连接字符串并希望在本地文件夹中创建数据库文件确实非常糟糕。始终考虑使用Azure SQL数据库或部署在Azure VM(或内部部署)中的SQL Server

答案 1 :(得分:0)

您需要确保使用门户网站中定义的连接字符串。如果使用默认值,则在发布时门户将覆盖本地设置。转到Azure门户中的移动服务的“配置”选项卡。您的Membership项目需要使用"连接字符串中的字符串MS_TableConnectionString"部分。