首页 新闻 搜索 专区 学院

项“attachdbfilename”的值无效。(MVC4+EF4.4 IIS6 会报这错,但II7不是正常的)

0
悬赏园豆:60 [已关闭问题] 关闭于 2016-01-28 11:30

“/”应用程序中的服务器错误。


 

项“attachdbfilename”的值无效。

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.ArgumentException: 项“attachdbfilename”的值无效。

源错误: 

执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。


堆栈跟踪: 

[ArgumentException: 项“attachdbfilename”的值无效。]
   System.Data.SqlClient.SqlConnectionString.VerifyLocalHostAndFixup(String& host, Boolean enforceLocalHost, Boolean fixup) +897526
   System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +4085
   System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
   System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +150
   System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +59
   System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
   System.Data.SqlClient.SqlConnection..ctor(String connectionString) +26
   System.Data.Entity.Infrastructure.SqlConnectionFactory.CreateConnection(String nameOrConnectionString) +236
   System.Data.Entity.Infrastructure.LocalDbConnectionFactory.CreateConnection(String nameOrConnectionString) +281
   System.Data.Entity.Internal.LazyInternalConnection.Initialize() +329
   System.Data.Entity.Internal.LazyInternalConnection.get_Connection() +13
   System.Data.Entity.Internal.LazyInternalContext.get_Connection() +93
   Genealogy.Framework.DAL.DbContextBase..ctor(String connectionString) +80
   Genealogy.Core.Log.LogDbContext..ctor() +29
   Genealogy.Account.DAL.AccountDbContext..ctor() +46
   Genealogy.Account.BLL.AccountService.SaveUser(User user, Boolean isLog) +84
   Castle.Proxies.Invocations.IAccountService_SaveUser.InvokeMethodOnTarget() +129
   Castle.DynamicProxy.AbstractInvocation.Proceed() +91
   Genealogy.Core.Service.InvokeInterceptor.Intercept(IInvocation invocation) +197
   Castle.DynamicProxy.AbstractInvocation.Proceed() +132
   Castle.Proxies.IAccountServiceProxy.SaveUser(User user, Boolean isLog) +163
   Genealogy.Web.Admin.Areas.Account.Controllers.AuthController.Registration(FormCollection collection) +187
   lambda_method(Closure , ControllerBase , Object[] ) +108
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +188
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +59
   System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +240
   System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +31
   System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +23
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +128
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +26
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +41
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +28
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +28
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +30
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8836977
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

 


版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.1

=======================================================================

问题如题,

Data Source=IP地址;Initial Catalog=数据库名;Persist Security Info=True;User ID=sa;Password=sa

 

将上面字符串赋值给EF的ConnectionString  报错

this.Database.Connection.ConnectionString = connectionString;

 

请大帮帮忙

问题补充:

IIS7上是正常的

三瑞的主页 三瑞 | 菜鸟二级 | 园豆:232
提问于:2016-01-24 14:49
< >
分享
所有回答(1)
0

解决了吗,部署到服务器上就这样,自己机器上好的,我也碰到这个问题

Chanty | 园豆:202 (菜鸟二级) | 2016-10-12 13:56

没有,好多人都说,这在2003 II6 都不行,换高版本吧

支持(0) 反对(0) 三瑞 | 园豆:232 (菜鸟二级) | 2016-10-12 14:06
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册