我有一个项目类型Azure Mobile Service,我尝试使用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 .__ Error.WinIOError(Int32 errorCode,String maybeFullPath)\ r \ n在System.IO.Directory.InternalCreateDirectory(String fullPath,String path,Object dirSecurityObj,Boolean checkHost)\ r \ n在System.IO.Directory.InternalCreateDirectoryHelper(String path,Boolean checkHost)\ r \ n at System.IO.Directory.CreateDirectory(String path)\ r \ n在System.Web.Data.ccessAccess.SqlConnectionHelper的System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName,String dataDir,String connectionString)\ r \ n在System.Web.DataAccess.SqlConnectionHelper.EnsureDBFile(String connectionString)\ r \ n中.GetConnection(String connectionString,Boolean revertImpersonation)\ r \ n在System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(St ring username,Boolean updateLastLoginActivityDate,Int32& status,String&密码,Int32& passwordFormat,String& passwordSalt,Int32& failedPasswordAttemptCount,Int32& failedPasswordAnswerAttemptCount,Boolean& isApproved,DateTime& lastLoginDate,DateTime&在System.Web.Security.SqlMembershipProvider的System.Web.Security.SqlMembershipProvider.CheckPassword(String username,String password,Boolean updateLastLoginActivityDate,Boolean failIfNotApproved,String& salt,Int32& passwordFormat)\ r \ n中的lastActivityDate)\ r \ n。 ValidateUser(String username,String password)\ r \ n在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 }
答案 0 :(得分:0)
根据您的描述,我认为您在Azure移动应用程序中引用了本地SQL实例。据我所知,Azure移动应用程序中没有SQL安装。您无法在App_Data中使用.mdf文件。这就是您的应用程序可以在本地运行而不在Azure移动应用程序中运行的原因。如果您想授权Azure移动应用程序,我建议您使用Azure AD,请参阅this article以获取更多信息。