C# 为什么我的Azure广告验证会显示;系统找不到指定的文件";登录时出错?

C# 为什么我的Azure广告验证会显示;系统找不到指定的文件";登录时出错?,c#,asp.net-mvc,azure,authentication,C#,Asp.net Mvc,Azure,Authentication,我的MVC web应用程序使用Azure AD身份验证让用户登录到安全区域,它有两个区域称为Area1和Area2。要设置Azure Active Directory身份验证,我从我的项目菜单中选择了配置Azure AD身份验证,然后按照向导进行操作。这促使我做了一些事情,因为在我允许它自己将广告与我的客户挂钩之前,我从未设置过它 Azure Active Directory身份验证向导向我的应用程序中的每个控制器(两个区域)添加和[Authorize]标记,但是,只有Area1需要安全Area

我的MVC web应用程序使用Azure AD身份验证让用户登录到安全区域,它有两个区域称为
Area1
Area2
。要设置Azure Active Directory身份验证,我从我的项目菜单中选择了
配置Azure AD身份验证
,然后按照向导进行操作。这促使我做了一些事情,因为在我允许它自己将广告与我的客户挂钩之前,我从未设置过它

Azure Active Directory身份验证向导向我的应用程序中的每个控制器(两个区域)添加和
[Authorize]
标记,但是,只有
Area1
需要安全
Area2
是公共的。我从
区域2的控制器中删除了
[Authorize]
标记,以便它知道在提供页面之前不请求身份验证

在此阶段,
[Authorize]
标签仅存在于
区域1
控制器中,因为这些标签应该是安全的

当我在Azure中运行我的应用程序时,我可以获得登录页面,但当我单击登录时,我会收到以下错误消息

系统找不到指定的文件

[Win32Exception (0x80004005): The system cannot find the file specified]

[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)]
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) +821
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +332
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +699
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +89
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +426
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78
   System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +191
   System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +154
   System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +21
   System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +90
   System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +217
   System.Data.SqlClient.SqlConnection.Open() +96
   System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(DbConnection t, DbConnectionInterceptionContext c) +10
   System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch(TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) +72
   System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext) +359
   System.Data.Entity.SqlServer.<>c__DisplayClass33.<UsingConnection>b__32() +426
   System.Data.Entity.SqlServer.<>c__DisplayClass1.<Execute>b__0() +10
   System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1 operation) +189
   System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation) +77
   System.Data.Entity.SqlServer.SqlProviderServices.UsingConnection(DbConnection sqlConnection, Action`1 act) +174
   System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection sqlConnection, Action`1 act) +556
   System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(Nullable`1 commandTimeout, DbConnection sqlConnection, String createDatabaseScript) +86
   System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(DbConnection connection, Nullable`1 commandTimeout, StoreItemCollection storeItemCollection) +164
   System.Data.Entity.Core.Common.DbProviderServices.CreateDatabase(DbConnection connection, Nullable`1 commandTimeout, StoreItemCollection storeItemCollection) +76
   System.Data.Entity.Core.Objects.ObjectContext.CreateDatabase() +134
   System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(DbConnection connection) +119
   System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase) +142
   System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration) +78
   System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext internalContext, Func`3 createMigrator, ObjectContext objectContext) +89
   System.Data.Entity.Internal.InternalContext.CreateDatabase(ObjectContext objectContext, DatabaseExistenceState existenceState) +116
   System.Data.Entity.Database.Create(DatabaseExistenceState existenceState) +218
   System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +151
   System.Data.Entity.Internal.<>c__DisplayClassf`1.<CreateInitializationAction>b__e() +76
   System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +60
   System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +357
   System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c) +7
   System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +110
   System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +198
   System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +73
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +28
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +53
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15
   System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +38
   System.Linq.Queryable.FirstOrDefault(IQueryable`1 source, Expression`1 predicate) +83
   MyProject.Models.ADALTokenCache..ctor(String signedInUserId) in C:\Users\John\Desktop\Development\MyProject\Models\AdalTokenCache.cs:26
   MyProject.Startup.<ConfigureAuth>b__7_0(AuthorizationCodeReceivedNotification context) in C:\Users\John\Desktop\Development\MyProject\App_Start\Startup.Auth.cs:54
   Microsoft.Owin.Security.OpenIdConnect.<AuthenticateCoreAsync>d__1a.MoveNext() +4931
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +26
   Microsoft.Owin.Security.OpenIdConnect.<AuthenticateCoreAsync>d__1a.MoveNext() +6453
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Security.Infrastructure.<BaseInitializeAsync>d__0.MoveNext() +571
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Security.Infrastructure.<Invoke>d__0.MoveNext() +255
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<RunApp>d__5.MoveNext() +182
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Security.Infrastructure.<Invoke>d__0.MoveNext() +638
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<RunApp>d__5.MoveNext() +182
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<DoFinalWork>d__2.MoveNext() +180
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) +69
   Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) +64
   System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +380
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
[Win32Exception(0x80004005):系统找不到指定的文件]
[SqlException(0x80131904):建立与SQL Server的连接时发生网络相关或特定于实例的错误。找不到或无法访问该服务器。请验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。(提供程序:SQL网络接口,错误:52-找不到本地数据库运行时安装。请验证SQL Server Express是否已正确安装,以及本地数据库运行时功能是否已启用。)]
System.Data.SqlClient.SqlInternalConnectionDS..ctor(DbConnectionPoolIdentity、SqlConnectionString connectionOptions、SqlCredential凭证、对象提供信息、String newPassword、SecureString newSecurePassword、Boolean redirectedUserInstance、SqlConnectionString userConnectionOptions、SessionData重新连接SessionData、DbConnectionPool池、String accessToken、Boolean applyTransientF奥兰多+821
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions选项、DbConnectionPoolKey poolKey、Object poolGroupProviderInfo、DbConnectionPool池、DbConnectionOwningConnection、DbConnectionOptions用户选项)+332
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool池、DbConnectionOwningObject、DbConnectionOptions选项、DbConnectionPoolKey池键、DbConnectionOptions用户选项)+38
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection-owningObject、DbConnectionOptions-userOptions、DbConnectionInternal-oldConnection)+699
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject、DbConnectionOptions userOptions、DbConnectionInternal oldConnection)+89
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection-owningObject,UInt32-waitForMultipleObjectsTimeout,布尔allowCreate,布尔OnlyOnEckConnection,DbConnectionOptions-userOptions,DbConnectionInternal&connection)+426
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject、TaskCompletionSource`1重试、DbConnectionOptions用户选项、DbConnectionInternal和connection)+78
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection、TaskCompletionSource`1重试、DbConnectionOptions用户选项、DbConnectionInternal oldConnection、DbConnectionInternal&connection)+191
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection,DbConnectionFactory connectionFactory,TaskCompletionSource`1 retry,DbConnectionOptions userOptions)+154
System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory,TaskCompletionSource`1重试,DbConnectionOptions用户选项)+21
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1重试)+90
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1重试)+217
System.Data.SqlClient.SqlConnection.Open()+96
System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.b_uu36(DbConnection t,DbConnectionInterceptionContext c)+10
System.Data.Entity.Infrastructure.InternalDispatcher`1.Dispatch(目标目标,操作`2操作,TInterceptionContext拦截上下文,操作`3执行,操作`3执行)+72
System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection-connection,DbInterceptionContext-interceptionContext)+359
System.Data.Entity.SqlServer.c__DisplayClass33.b__32()+426
System.Data.Entity.SqlServer.c__DisplayClass1.b__0()+10
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1操作)+189
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action操作)+77
System.Data.Entity.SqlServer.SqlProviderServices.UsingConnection(DbConnection-sqlConnection,Action`1-act)+174
System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection-sqlConnection,Action`1-act)+556
System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(可为null的`1 commandTimeout,DbConnection-sqlConnection,String-createDatabaseScript)+86
System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(DbConnection连接,null`1 commandTimeout,StoreItemCollection StoreItemCollection)+164
System.Data.Entity.Core.Common.DbProviderServices.CreateDatabase(DbConnection连接,null`1 commandTimeout,StoreItemCollection StoreItemCollection)+76
System.Data.Entity.Core.Objects.ObjectContext.CreateDatabase()+134
系统数据
 MyProject.Models.ADALTokenCache..ctor(String signedInUserId) in C:\Users\John\Desktop\Development\MyProject\Models\AdalTokenCache.cs:26
   MyProject.Startup.<ConfigureAuth>b__7_0(AuthorizationCodeReceivedNotification context) in C:\Users\John\Desktop\Development\MyProject\App_Start\Startup.Auth.cs:54