ASP.NET MVC3请求的名称有效,但未找到所请求类型的数据

时间:2013-09-11 17:28:22

标签: c# asp.net asp.net-mvc asp.net-mvc-3 entity-framework-5

带有Entity Framework 5(DB First)应用程序的.NET MVC3以及对db的所有访问引发了同样的错误

The requested name is valid, but no data of the requested type was found

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.Sockets.SocketException: The requested name is valid, but no data of the requested type was found

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[SocketException (0x2afc): The requested name is valid, but no data of the requested type was found]
   System.Net.Dns.GetAddrInfo(String name) +6603626
   System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6) +106
   System.Net.Dns.GetHostEntry(String hostNameOrAddress) +109
   MySql.Data.Common.StreamCreator.GetDnsHostEntry(String hostname) +75

[Exception: Call to GetHostEntry failed after 00:00:00 while querying for hostname 'xxxxxxxx.db.1and1.com': SocketErrorCode=NoData, ErrorCode=11004, NativeErrorCode=11004.]
   MySql.Data.Common.StreamCreator.GetDnsHostEntry(String hostname) +349
   MySql.Data.Common.StreamCreator.GetHostEntry(String hostname) +36
   MySql.Data.Common.StreamCreator.GetStreamFromHost(String pipeName, String hostName, UInt32 timeout) +70
   MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout) +204
   MySql.Data.MySqlClient.NativeDriver.Open() +370

[MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.]
   MySql.Data.MySqlClient.NativeDriver.Open() +428
   MySql.Data.MySqlClient.Driver.Open() +22
   MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) +218
   MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() +287
   MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() +93
   MySql.Data.MySqlClient.MySqlPool.GetConnection() +65
   MySql.Data.MySqlClient.MySqlConnection.Open() +543
   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +44

[EntityException: The underlying provider failed on Open.]
   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +203
   System.Data.EntityClient.EntityConnection.Open() +104
   System.Data.Objects.ObjectContext.EnsureConnection() +75
   System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +41
   System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +36
   System.Data.Entity.Internal.Linq.InternalQuery`1.GetEnumerator() +72
   System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() +23
   System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator() +40
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +369
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
   domvaproject.Controllers.PropiedadesController.Index() +21
   lambda_method(Closure , ControllerBase , Object[] ) +62
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +182
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +56
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +256
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +22
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +190
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +311
   System.Web.Mvc.Controller.ExecuteCore() +105
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +88
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +34
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +31
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +23
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +59
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9628700
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

我的托管服务提供商(1and1)告诉我问题是我的,但我认为这个问题是由DNS中的一些错误引起的。他们告诉我错误在代码中,但它在每个连接上崩溃

1 个答案:

答案 0 :(得分:3)

由于我的连接字符串,我得到了同样的错误。它包含一个端口号,但正确的连接字符串必须是这样的:

<add name="myConnectionString" connectionString="Server=localhost;Database=mydatabase;Uid=root;Pwd=password;Allow Zero Datetime=true" providerName="MySql.Data.MySqlClient"/>