2016-08-29 39 views
0

我有一个项目类型Azure移动服务,我尝试使用Membership.ValidateUser。在本地服务器工作正常。 {“ClassName”:“System.UnauthorizedAccessException”,“Message”:“访问路径'D:\ Program Files(x86)\ SiteExtensions \ MobileServicesDotNet \ 1.0.478 \ App_Data'被拒绝。”,数据“:null,”InnerException“:null,”HelpURL“:null,”StackTraceString“:”System.IO.Directory.InternalCreateDirectory中System.IO .__ Error.WinIOError(Int32错误代码,字符串maybeFullPath)\ r \ n (String path,Boolean checkHost)\ r \ n System.IO.Directory.CreateDirectory(String path)\ r \ n System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName,String dataDir,String connectionString)\ r \ n在System.Web.DataAccess.SqlConnectionHelper.EnsureDBFile(字符串connectionString)\ r \ n在System.Web.DataAccess。 SqlConnectionHelper.GetConnection(String connectionString,布尔revertImpersonation个)\ r \ n在System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(字符串username,布尔updateLastLoginActivityDate,的Int32 &状态,字符串&密码,的Int32 &了passwordFormat,字符串& passwordSalt,的Int32 & failedPasswordAttemptCount,的Int32 & failedPasswordAnswerAttemptCount,布尔& isApproved,日期时间& lastLoginDate,日期时间& lastActivityDate个)\ r \ n在System.Web.Security.SqlMembershipProvider.CheckPassword(字符串username,字符串密码,布尔updateLastLoginActivityDate,布尔failIfNotApproved,字符串&盐,的Int32 &了passwordFormat个)\ r \ n在System.Web.Security.SqlMembershipProvider.ValidateUser(〜应变g用户名,字符串密码)\ r \ n at jLanBriefcaseServices.Controllers.AuthController.Signin(UserLogin userLogin)“,”RemoteStackTraceString“:null,”RemoteStackIndex“:0,”ExceptionMethod“:”8 \ nWinIOError \ nmscorlib,Version = 4.0 .0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089 \ nSystem.IO .__ Error \ nVoid WinIOError(Int32,System.String)“,”HResult“: - 2147024891,”Source“:”mscorlib“,”WatsonBuckets“:null}Azure移动服务 - 访问App_Data被拒绝

+0

您可以使用称为Kudu的Azure基于Web的诊断工具,并按照[教程](https://blogs.msdn.microsoft.com/benjaminperkins/2014/03/24/using-kudu-with-windows- azure-web-sites /)检查详细错误中提到的目录。从错误中,我认为你的连接字符串有问题,你使用本地数据库吗? –

回答

0

根据您的描述,我认为您正在Azure移动应用程序中引用本地SQL实例。据我所知,Azure移动应用程序中没有安装SQL。您不能在App_Data中使用.mdf文件。这就是为什么你的应用程序可以在本地运行而不能在Azure移动应用程序中运行。如果您想授权Azure移动应用程序,我建议您改用Azure AD,请参阅this article了解更多信息。