2015-01-26 1 views
0

나는이 오류와 게시물 무리가 알지만,이 MVC 프로젝트에서 얻지 못합니다. 간단한 ASP.net 빈 웹 사이트를 만든 다음 app_Data 폴더를 만들고 SQL 데이터베이스를 만들고 테이블을 추가 한 다음 웹 양식을 만들었습니다. 앱을 실행하려고 할 때마다이 오류가 발생합니다. MVC 같은 전혀 문제가없는 다른 ASP.NET 프로젝트를 실행할 수 있고 데이터 공급자가 동일하므로 이중 확인했습니다. 어쨌든, 정보는 다음과 같습니다.요청한 .NET Framework 데이터 공급자를 찾을 수 없습니다. 그것은 설치되지 않을 수도 있습니다

<connectionStrings> 
    <add name="principal" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFileName=|DataDirectory|\Database.mdf;Integrated Security=True" providerName="System.Data.SqlClient" /> 
    </connectionStrings> 

데이터베이스 이름이 정확하고 다시 체크됩니다. 게다가, 나는 동일한 연결 문자열을 가진 다른 프로젝트를 가지고 그것을 작동합니다 (그러나 밤은 asp.net 양식, 그 MVC 프로젝트) 오류에 대한

정보 :

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. 

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: 


[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.] 
    System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1442135 
    System.Web.UI.WebControls.SqlDataSource.GetDbProviderFactory() +67 
    System.Web.UI.WebControls.SqlDataSource.GetDbProviderFactorySecure() +22 
    System.Web.UI.WebControls.SqlDataSource.CreateConnection(String connectionString) +11 
    System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +113 
    System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21 
    System.Web.UI.WebControls.DataBoundControl.PerformSelect() +138 
    System.Web.UI.WebControls.ListView.PerformSelect() +167 
    System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30 
    System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +105 
    System.Web.UI.WebControls.ListView.CreateChildControls() +122 
    System.Web.UI.Control.EnsureChildControls() +83 
    System.Web.UI.Control.PreRenderRecursiveInternal() +42 
    System.Web.UI.Control.PreRenderRecursiveInternal() +155 
    System.Web.UI.Control.PreRenderRecursiveInternal() +155 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237 

답변

1

내가 고칠 수 있었다 내 문제는, 이것이 버그인지는 모르겠지만, 그런 것처럼 보입니다. 내 SQL 데이터 소스에서이 문제를 가지고 사용 :

<asp:SqlDataSource ID="MensagemSqlDataSource" runat="server" 
      ConnectionString="<%$ ConnectionStrings:principal %>" 
      ProviderName="<%$ ConnectionStrings:principal.ProviderName %>" 
      SelectCommand="SELECT Codigo,Assunto FROM Mensagem WHERE Resposta IS NULL ORDER BY Codigo" 
      DeleteCommand="DELETE FROM Mensagem WHERE Codigo = @Codigo"> 

//(...) doesn't matter the rest of the code (...) 

은 그래서에는 ProviderName 라인은 ConnectionStrings를 가리키는되었습니다 principal.ProviderName는, 마녀는 내 첫 번째 게시물에 명시된 바와 같이 "의 System.Data.SQLClient"입니다. 그래서 방금 변경 :

<asp:SqlDataSource ID="mensagemBlog" 
      runat ="server" 
      ConnectionString ="<%$ ConnectionStrings:principal %>" 
      ProviderName ="System.Data.SqlClient" 
      SelectCommand ="SELECT Codigo,Assunto FROM Mensagem WHERE Resposta IS NULL ORDER BY Codigo" 
      DeleteCommand="DELETE FROM Mensagem WHERE Codigo = @Codigo" > 

그리고 그것은 효과가있다. 어쩌면 이것은 어떤 종류의 버그이거나 그 명령이 어떻게 작동하는지 오인 한 것입니다.

+0

오라클 익스프레스 에디션에서도 똑같은 일이 발생했습니다. 공급자 이름을 "System.Data.OracleClient"로 변경하면 해결되었습니다. –

관련 문제