c# - ASP.Net 无法找到 .Net Framework 提供程序

标签 c# asp.net mysql visual-studio connection-string

在将网站上传到 Godaddy 服务器的过程中,使用 MySql 的数据网格引发了问题。错误与 Web 配置一起输出如下。问题似乎是服务器没有正确安装的要求,例如我的 Web 配置中的 MySql.Data,但我不确定该怎么办。 .Net MySql 连接器安装在本地系统上并且运行良好。这是输出的错误。

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.


[ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not   be installed.]
   System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1419911
  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) +117
 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
  System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
  System.Web.UI.WebControls.GridView.DataBind() +4
  System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
  System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
  System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
  System.Web.UI.Control.PreRenderRecursiveInternal() +175
  System.Web.UI.Control.PreRenderRecursiveInternal() +175
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean     includeStagesAfterAsyncPoint) +2496

网络配置:

<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>

<add name="GoDaddy" connectionString=" Server=***; Database=kappalambda; User ID=***; Password=***; Trusted_Connection=False" providerName="System.Data.SqlClient" />



<!--<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial  Catalog=aspnet-Kappa Lambda-20130125180802;Integrated  Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-Kappa Lambda-20130125180802.mdf"
    providerName="System.Data.SqlClient" />     
         -->
   <add name="noahtk_DirectoryKappaSigAppConnectionString"  connectionString="server=***;User  Id=noahtk_klofks;password=***;database=***"
   providerName="MySql.Data.MySqlClient" />




  <!--  <add name="liveConnection" connectionString="server=****; User     Id=***; password=****#; database=****" providerName="System.Data.SqlClient"/>  
   -->

  </connectionStrings>

</authentication>

<profile defaultProvider="Godaddy">
  <providers>
    <add name="Godaddy" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="Godaddy" applicationName="/" />
  </providers>
</profile>
<membership defaultProvider="Godaddy">
  <providers>

   <!--
        If you are deploying to a cloud environment that has multiple web server instances,
        you should change session state mode from "InProc" to "Custom". In addition,
        change the connection string named "DefaultConnection" to connect to an instance
        of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.
      -->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
  <providers>
    <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
  </providers>
</sessionState>

最佳答案

您可能需要对数据提供程序进行 bin 部署。 This来自 GoDaddy 的链接描述了如何 bin 部署 ASP.NET MVC dll,但对于包含数据提供程序的 MySQL DLL,该过程应该类似(即 copy-local 应设置为 true)。

抱歉,如果我没有走上正轨。

HTH, 内森

关于c# - ASP.Net 无法找到 .Net Framework 提供程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15490831/

相关文章:

c# - ClickOnce 应用程序跳过请求更新(如果选择跳过,则启动失败)

c# - 带有可选参数的构造函数违反了 new() 约束

c# - 循环遍历 XDocument 的元素并获取特定属性

php - 使用 Laravel Eloquent 关系检索正确结果时出现问题

c# - 将 ZIP 文件插入数据库

c# - .NET/SQLite。插入父/子记录;我如何获得外键?

asp.net - GoDaddy 发送电子邮件

c# - 如何在asp.net fileupload中上传后显示图片

.net - 在不停机的情况下部署 ASP.NET 网站更改和 SQL Server 更改

php - php中rand函数的问题