我正在测试一个网站,mvc 4网站;我正在学习MVC。
我已将网站发布到我的个人主机上,在我的电脑上运行良好,但一旦在我的主机上我有一个错误,这里首先是连接字符串:(我正在使用northwind练习)
<add name="NorthwindEntities" connectionString="metadata=res://*/Models.NorthWindModel.csdl|res://*/Models.NorthWindModel.ssdl|res://*/Models.NorthWindModel.msl;
provider=System.Data.SqlClient;
provider connection string="
data source=**************.db.********.hostedresource.com;;
initial catalog=**********;
User ID=******;
MultipleActiveResultSets=True;
App=EntityFramework"
Password='********';
integrated security=True;"
providerName="System.Data.EntityClient" />
这是错误:
初始化字符串的格式不符合从索引166开始的规范。 描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.ArgumentException:初始化字符串的格式不符合从索引166开始的规范。
来源错误:
在执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息。
堆栈追踪:
[ArgumentException:初始化字符串的格式不符合从索引166开始的规范。]
System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString,Int32 currentPosition,StringBuilder buffer,Boolean useOdbcRules,String&amp; keyname,String&amp; keyvalue)+5078242
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable,String connectionString,Boolean buildChain,Hashtable synonyms definitions,Boolean firstKey)+132
System.Data.Common.DbConnectionOptions..ctor(String connectionString,Hashtable synonyms definitions,Boolean useOdbcRules)+98
System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)+118
System.Data.EntityClient.EntityConnection..ctor(String connectionString)+81
System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection)+78
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name,AppConfig config)+32
System.Data.Entity.Internal.LazyInternalConnection.Initialize()+ 131
System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()+13
System.Data.Entity.Internal.LazyInternalContext.InitializeContext()+281
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)+18
System.Data.Entity.Internal.Linq.InternalSet 1.Initialize() +56
System.Data.Entity.Internal.Linq.InternalSet
1.GetEnumerator()+15
System.Data.Entity.Infrastructure.DbQuery 1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator() +40
System.Collections.Generic.List
1..ctor(IEnumerable 1 collection) +315
System.Linq.Enumerable.ToList(IEnumerable
1 source)+58
MvcApplication1.Controllers.HomeController.Index()+ 21
lambda_method(Closure,ControllerBase,Object [])+62
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller,Object []参数)+17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext,IDictionary 2 parameters) +188
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2个参数)+27
System.Web.Mvc.Async。&lt;&gt; c_ DisplayClass42.b _41()+28
System.Web.Mvc.Async。&lt;&gt; 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。&lt;&gt; c _DisplayClass39.b_ 33()+59
System.Web.Mvc.Async。&lt;&gt; c _DisplayClass4f.b_ 49()+240
System.Web.Mvc.Async。&lt;&gt; c _DisplayClass37.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。&lt;&gt; c _DisplayClass1d.b_ 18(IAsyncResult asyncResult)+14
System.Web.Mvc.Async。&lt;&gt; c _DisplayClass4.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。&lt;&gt; c _DisplayClass8.b_ 3(IAsyncResult asyncResult)+28
System.Web.Mvc.Async。&lt;&gt; c _DisplayClass4.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()+8970061
System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+184
那么,世界上到底发生了什么?我尝试过很多不同的connectionStrings而没有成功。
由于
答案 0 :(得分:3)
两个相邻;;在第166位。
答案 1 :(得分:0)
请尝试按照这些GoDaddy文章中的信息进行操作:
Locating Your Database Connection Strings
Connecting to a SQL Server Database Using ASP.NET 3.5(我意识到你正在使用asp.net mvc 4,但也许这会有所帮助)
如果您需要更多帮助,请联系GoDaddy,因为这对于StackOverflow问题来说太具体/本地化