Итак, я пытаюсь изучить ASP.NET, но я застрял, когда дело доходит до соединений с БД.C# ASP.NET подключение к ошибке базы данных
я получаю следующее сообщение об ошибке:
Unable to find the requested .Net Framework Data Provider. It may not be installed.
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.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
и
Stack Trace:
[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.]
System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1480903
WebMatrix.Data.DbProviderFactoryWrapper.CreateConnection(String connectionString) +63
WebMatrix.Data.<>c__DisplayClass15.b__14() +16
WebMatrix.Data.Database.get_Connection() +19
WebMatrix.Data.Database.EnsureConnectionOpen() +12
WebMatrix.Data.d__0.MoveNext() +66
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +381
System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
WebMatrix.Data.Database.Query(String commandText, Object[] parameters) +102
ASP._Page_NewUser_cshtml.Execute() in c:\Users\Euaggelos\Documents\Visual Studio 2013\WebSites\WebSite5\NewUser.cshtml:20
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +199
System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +69
System.Web.WebPages.WebPage.ExecutePageHierarchy() +131
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +116
Проблема заключается в том, что у меня есть .net Framework Поставщик данных установлен.
Вот часть моего кода:
<connectionStrings>
<add name="DB1Entities" connectionString="metadata=res://*/App_Code.Model.csdl|res://*/App_Code.Model.ssdl|res://*/App_Code.Model.msl;provider=System.Data.SqlClient;provider connection string="data source=(LocalDB)\v11.0;attachdbfilename=|DataDirectory|\DB1Entities.mdf;integrated security=True;connect timeout=30;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
@using WebMatrix.Data;
@{
Page.Title = "Add you user";
Layout = "_Layout.cshtml";
var db = Database.Open("DB1Entities");
var selectQueryString = "SELECT * FROM Users ORDER BY FirstName";
}
<h1>New user</h1>
<table>
<tr>
<th>Id</th>
<th>First name</th>
<th>Last name</th>
</tr>
@foreach (var row in db.Query(selectQueryString)) <!--THIS IS THE ERROR LINE-->
{
<tr>
<td>@row.Id</td>
<td>@row.FirstName</td>
<td>@row.LastName</td>
</tr>
}
</table>
UNKOWN ну, может быть попытка восстановления или удаления может также помочь в использовании ASP.NET, когда MVC - это путь вперед. – Enzero
Я ремонтировал его несколько раз, с перезапуском между ними и ничего не произошло. Если бы вы могли предоставить хороший учебник MVC, я буду более чем счастлив проверить его. –
есть хороший курс в [multipalsight] (http://www.pluralsight.com/courses/asp-dotnet-5-first-look), хотя есть и другие доступные курсы. [ASP.NET 5: First Look ] (http://www.pluralsight.com/courses/asp-dotnet-5-first-look) – Enzero