I built a web app in Visual Studio 2019 .net that runs fine when hosted in IIS. The web app connects to a MySql server on my Synology NAS. I want to build a docker image for it to move it to the synology server, but when I try to run the docker image created by Visual Studio I receive the following error when playing the image:
Server Error in '/' Application.
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) 1326077
System.Web.UI.WebControls.SqlDataSource.GetDbProviderFactorySecure() 35
System.Web.UI.WebControls.SqlDataSource.CreateConnection(String connectionString) 15
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) 140
System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) 389
System.Web.UI.WebControls.ListControl.PerformSelect() 44
System.Web.UI.Control.DataBindChildren() 248
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) 195
System.Web.UI.Control.DataBindChildren() 248
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) 195
System.Web.UI.Control.DataBindChildren() 248
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) 195
System.Web.UI.Control.DataBindChildren() 248
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) 195
System.Web.UI.WebControls.FormView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) 2704
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) 97
System.Web.UI.WebControls.FormView.PerformDataBinding(IEnumerable data) 17
System.Web.UI.WebControls.FormView.EnsureDataBound() 198
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() 106
System.Web.UI.Control.EnsureChildControls() 107
System.Web.UI.Control.PreRenderRecursiveInternal() 58
System.Web.UI.Control.PreRenderRecursiveInternal() 227
System.Web.UI.Control.PreRenderRecursiveInternal() 227
System.Web.UI.Control.PreRenderRecursiveInternal() 227
System.Web.UI.Control.PreRenderRecursiveInternal() 227
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 3671
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4494.0
I have tried to install all of the MySql connectors but still can't get it to work. I am very new to docker. As in I have no clue what I am doing. I can get the app to run it just errors out when it goes to a page that tries to connect to the DB.
CodePudding user response:
First, please confirm whether you have installed the mysql.net connector. If not, install it.
If the installation of mysql.net connector does not work, this may be the case:
If the provider is not registered in one of that files the reported error is thrown.
Please change the following configuration in asp.net web.config like this:
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.DataAccess.Client" />
<add name="Oracle Data Provider for .NET"
invariant="Oracle.DataAccess.Client"
description="Oracle Data Provider for .NET"
type="Oracle.DataAccess.Client.OracleClientFactory,
Oracle.DataAccess,
Version=2.111.7.20,
Culture=neutral,
PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
CodePudding user response:
I think I finally figured it out. I was using the Server explorer Data Connections to create the MySql connections, but docker does not like this. So I changed everything to c# code data connections and it is now working in docker.