2013-07-10 4 views
2

사내 서버에 asp.net 4.5 mvc4 앱을 배포하려고합니다. 빌드 파일은 서버에 최대하지만 사이트에 액세스하려고하는 것은 이러한 오류 yeilds :mvc4 웹 사이트를 서버에 배포 할 때 발생하는 문제

[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.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +6676046 
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +810 
    System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +6702720 
    System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +219 
    System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +6704856 
    System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +6705315 
    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions) +610 
    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +1049 
    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +74 
    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions) +6707883 
    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions) +78 
    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +2192 
    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +116 
    System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1012 
    System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +6712511 
    System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +152 
    System.Data.SqlClient.SqlConnection.Open() +229 
    System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action`1 act) +134 
    System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 act) +3805119 
    System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +10957386 
    System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +91 

[ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.] 
    System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +10957457 
    System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +48 

[ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.] 
    System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +242 
    System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +82 
    System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +88 
    System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +248 
    System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +524 
    System.Data.Entity.Internal.InternalContext.CreateObjectContextForDdlOps() +23 
    System.Data.Entity.Database.Exists() +40 
    Horizon.Filters.SimpleMembershipInitializer..ctor() in c:\Builds\1\Horizon\Horizon\Sources\Horizon\Code\Horizon\Filters\InitializeSimpleMembershipAttribute.cs:34 

[InvalidOperationException: The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588] 
    Horizon.Filters.SimpleMembershipInitializer..ctor() in c:\Builds\1\Horizon\Horizon\Sources\Horizon\Code\Horizon\Filters\InitializeSimpleMembershipAttribute.cs:47 

[TargetInvocationException: Exception has been thrown by the target of an invocation.] 
    System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 
    System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +159 
    System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +256 
    System.Activator.CreateInstance(Type type, Boolean nonPublic) +127 
    System.Activator.CreateInstance(Type type) +11 
    System.Threading.LazyHelpers`1.ActivatorFactorySelector() +72 
    System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +241 
    System.Threading.LazyInitializer.EnsureInitialized(T& target, Boolean& initialized, Object& syncLock) +139 
    Horizon.Filters.InitializeSimpleMembershipAttribute.OnActionExecuting(ActionExecutingContext filterContext) in c:\Builds\1\Horizon\Horizon\Sources\Horizon\Code\Horizon\Filters\InitializeSimpleMembershipAttribute.cs:21 
    System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeActionMethodFilterAsynchronously(IActionFilter filter, ActionExecutingContext preContext, Func`1 nextInChain) +145 
    System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeActionMethodFilterAsynchronously(IActionFilter filter, ActionExecutingContext preContext, Func`1 nextInChain) +980 
    System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__31(AsyncCallback asyncCallback, Object asyncState) +264 
    System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +146 
    System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +202 
    System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag) +112 
    System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__1e(AsyncCallback asyncCallback, Object asyncState) +955 
    System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +146 
    System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +166 
    System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag) +27 
    System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__17(AsyncCallback asyncCallback, Object asyncState) +50 
    System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +146 
    System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +166 
    System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +497 
    System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +146 
    System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +166 
    System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag) +27 
    System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +409 
    System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__2(AsyncCallback asyncCallback, Object asyncState) +144 
    System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +146 
    System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +166 
    System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag) +27 
    System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +364 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +12550671 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288 

나는 내 연결 문자열 함께 할 수있는 뭔가가 생각 :

<add name="MyDatabase" connectionString="data source=Server;initial 
catalog=MyDatabase;User Id=App;Password=some password;" 
providerName="System.Data.SqlClient"/> 

생각을

+0

다음은 스택 추적의 나머지 부분입니다. – Nucelarkumquat

답변

0

1) 해당 서버 이름 (Server)이 맞습니까? 이 이름은 SQL Management Studio 또는 Visual Studio에서 연결할 때 표시되는 이름입니까? SQL Server의 버전 및 에디션은 무엇입니까?

2) 연결 문자열 매개 변수가 UDL 파일에서 작동합니까?

3) 연결 문자열이 예상 한 것과 일치하는지 확인하십시오. log4.net을 사용하여 연결 문자열을 로깅하는 예를 아래에 제공했지만 텍스트 파일에 중단 점을 넣거나 쓸 수는 있습니다.

m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 
foreach(var connectionString in System.Configuration.ConfigurationManager.ConnectionStrings) 
{ 
    string outString = connectionString.ToString(); 
    m_log.Debug(outString); 
} 
1

그래, 문제는 UsersContext가 기본 연결 문자열을 여전히 사용하고 있기 때문입니다. 방금 연결 문자열로 기본 컨텍스트를 변경해야했습니다.

public class UsersContext : DbContext 
{ 
    public UsersContext() 
     : base("MyDBContext") 
    { 
    } 

    public DbSet<UserProfile> UserProfiles { get; set; } 
    public DbSet<webpages_Membership> webpages_Memberships { get; set; } 
    public DbSet<UsersInRole> webpages_UsersInRoles { get; set; } 
    public DbSet<Role> webpages_Roles { get; set; } 
} 

주의 할 점은, UsersContext 테이블과 자체 연결 문자열에 시간 초과 문제가 있습니다. 이 수정 프로그램을 사용하기 전에이 항목을 확인하십시오. SimpleMembership MVC 4 stays authenticated, but is not authenticated

0

파일 필터 FilterConfig.cs InitializeSimpleMembershipAttribute에 나타나는 줄을 주석 처리하여이 문제를 해결했습니다. 제가 사용하지 않는 codefirst와 출판물에있는 파일에 연결되어 있어야한다고 생각합니다.

관련 문제