Jump to content

[Solved] Asp.net Not Working With Mysql After Publishing To Heliohost


isitpossible

Recommended Posts

Hi,

 

I will appreciate any help possible.

 

Details: mysavings.heliohost.org

 

Currently getting error:

 

Failed to find or load the registered .Net Framework Data Provider 'MySql.Data.MySqlClient'.

 

 

 

Trying to connect to MySQL from asp.net:

 

Web.config -

 

<configuration>

<connectionStrings>

<remove name="LocalMySqlServer"/>

<add name="MySQLConnectionString"

connectionString="Datasource=johnny.heliohost.org;Database=mysaving_401Kmembers;

uid=mysaving_admin;pwd=******;"

providerName="MySql.Data.MySqlClient"/>

</connectionStrings>

<system.web>

 

<customErrors mode="Off"/>

</system.web>

</configuration>

 

If I run the website locally then it is able to connect to MySQL and show records from database table.

 

Am I missing something!!!

 

Thanks in advance for help.

Link to comment
Share on other sites

It might not be loading the MySql.Data.dll unless you add
      

inside the system.web tags.

 

Added but same error...

 

Just as an FYI, I am using MySQL Connector Net 6.6.5

 

Below web.config works fine from my desktop:

<configuration>

 

 

<system.data>

<DbProviderFactories>

<clear />

<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"

description=".Net Framework Data Provider for MySQL"

type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

</DbProviderFactories>

</system.data>

 

 

 

<connectionStrings>

<remove name="LocalMySqlServer"/>

<add name="MySQLConnectionString"

connectionString="Datasource=johnny.heliohost.org;Database=mysaving_401Kmembers;

uid=mysaving_admin;pwd=*****;"

providerName="MySql.Data.MySqlClient"/>

</connectionStrings>

<system.web>

<compilation>

<assemblies>

<add assembly="*"/>

</assemblies>

</compilation>

<customErrors mode="Off"/>

</system.web>

 

 

 

</configuration>

 

Link to comment
Share on other sites

Do you have MySql.Data.dll in your bin directory?

 

Yes, even tried this one but NO luck so far :(/&--#62;/&--#62;

I just looked at your account and not only can't I find any MySql.Data.dll file I can't even find a /bin directory. Did you delete it after you tried it or has it never existed?

 

EDIT:

 

Scratch that. I found your .dll files, but they are in /home/mysaving/bin/ not /home/mysaving/public_html/bin or /home/mysaving/public_html/SOMEAPP/bin Try it again with them in a ./bin relative to the .aspx file that is trying to connect to MySql.

Link to comment
Share on other sites

AS you sugested added a bin directory to public_html folder where aspx files reside and now i get below error:

 

 

Server Error in '/' Application

 

Compilation Error

Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error.

Compiler Error Message: : ** (/opt/mono/lib/mono/2.0/gmcs.exe:5693): WARNING **: Missing method .ctor in assembly /home/mysaving/public_html/bin/MySql.Data.Entity.dll, type System.Runtime.Versioning.TargetFrameworkAttribute

/default.aspx

Link to comment
Share on other sites

Where did you get these .dll's from? Are they designed to work with mono? If not, it's been a few years so it's hard to remember exactly, but I believe I downloaded my functional version from here http://dev.mysql.com/downloads/connector/net/ If that doesn't work either I can share my functional code and .dll with you. Don't give up yet; I know for a fact that it's definitely possible to connect asp.net to mysql, because I've done it, and it still works just fine for me.

Link to comment
Share on other sites

I downloaded from same location you mentioned above. I will appreciate if you can share your code and .dll if possible.

 

Also how do I reset my home directory, seems like by mistake i deleted all original folders created by default.

 

Seems like for some reason my password won't work so i tried to reset several times but now I am not even getting the confirmation code email (i did check junk/spam folders).

 

Thanks for your time and support.

Link to comment
Share on other sites

back to original problem:

 

I did copy mysql dll's to bin folder where the application resides, also changed web.config for 3.5 framework. Everything works fine if i connect remotely and run the website from my desktop, I am able to connect to mySQL db but it does not work when I deploy.

 

 

I am getting below error:

 

 

Server Error in '/mytest' Application

 

Compilation Error

Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error.

Compiler Error Message: : ** (/opt/mono/lib/mono/2.0/gmcs.exe:17652): WARNING **: Missing method .ctor in assembly /home/mysaving/public_html/mytest/bin/MySql.Data.Entity.dll, type System.Runtime.Versioning.TargetFrameworkAttribute

/mytest/default.aspx

 

 

 

 

gmcs /target:library /lib:"/home/mysaving/public_html/mytest/bin" /debug- /optimize+ /warn:4 /out:"/tmp/nobody-temp-aspnet-0/64f9a1b6/App_Web_7999426c.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.Web.Services/2.0.0.0__b03f5f7f11d50a3a/System.Web.Services.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.Runtime.Serialization/3.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.IdentityModel/3.0.0.0__b77a5c561934e089/System.IdentityModel.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.ServiceModel/3.0.0.0__b77a5c561934e089/System.ServiceModel.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.ServiceModel.Web/3.5.0.0__31bf3856ad364e35/System.ServiceModel.Web.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.Data.DataSetExtensions/3.5.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.Web.Extensions/3.5.0.0__31bf3856ad364e35/System.Web.Extensions.dll" /r:"/opt/mono-2.6.7/lib/mono/gac/System.Xml.Linq/3.5.0.0__b77a5c561934e089/System.Xml.Linq.dll" /r:"/home/mysaving/public_html/mytest/bin/MySql.Data.Entity.dll" /r:"/home/mysaving/public_html/mytest/bin/MySql.Data.dll" /r:"/home/mysaving/public_html/mytest/bin/MySql.Web.dll" /nowarn:0169 -- "/tmp/nobody-temp-aspnet-0/64f9a1b6/App_Web_7999426c_0.cs"

 

 

** (/opt/mono/lib/mono/2.0/gmcs.exe:17652): WARNING **: Missing method .ctor in assembly /home/mysaving/public_html/mytest/bin/MySql.Data.Entity.dll, type System.Runtime.Versioning.TargetFrameworkAttribute

 

** (/opt/mono/lib/mono/2.0/gmcs.exe:17652): WARNING **: The class System.Runtime.Versioning.TargetFrameworkAttribute could not be loaded, used in MySql.Data.Entity

 

** (/opt/mono/lib/mono/2.0/gmcs.exe:17652): WARNING **: Can't find custom attr constructor image: /home/mysaving/public_html/mytest/bin/MySql.Data.Entity.dll mtoken: 0x0a000002

 

** (/opt/mono/lib/mono/2.0/gmcs.exe:17652): WARNING **: Missing method .ctor in assembly /home/mysaving/public_html/mytest/bin/MySql.Data.dll, type System.Security.SecurityRulesAttribute

 

** (/opt/mono/lib/mono/2.0/gmcs.exe:17652): WARNING **: Can't find custom attr constructor image: /home/mysaving/public_html/mytest/bin/MySql.Data.dll mtoken: 0x0a00002b

 

** (/opt/mono/lib/mono/2.0/gmcs.exe:17652): WARNING **: Missing method .ctor in assembly /home/mysaving/public_html/mytest/bin/MySql.Web.dll, type System.Security.SecurityRulesAttribute

 

** (/opt/mono/lib/mono/2.0/gmcs.exe:17652): WARNING **: The class System.Security.SecurityRulesAttribute could not be loaded, used in MySql.Web

 

** (/opt/mono/lib/mono/2.0/gmcs.exe:17652): WARNING **: Can't find custom attr constructor image: /home/mysaving/public_html/mytest/bin/MySql.Web.dll mtoken: 0x0a00000d

 

Unhandled Exception: System.TypeLoadException: Could not load type 'System.Security.SecurityRulesAttribute' from assembly 'MySql.Web'.

at (wrapper managed-to-native) System.Reflection.Assembly:InternalGetType (System.Reflection.Module,string,bool,bool)

at System.Reflection.Assembly.GetType (System.String name, Boolean throwOnError, Boolean ignoreCase) [0x00000] in :0

at System.Reflection.Assembly.GetType (System.String name) [0x00000] in :0

at Mono.CSharp.RootNamespace.GetTypeInAssembly (System.Reflection.Assembly assembly, System.String name) [0x00000] in :0

at Mono.CSharp.RootNamespace.LookupTypeReflection (Mono.CSharp.CompilerContext ctx, System.String name, Location loc, Boolean must_be_unique) [0x00000] in :0

at Mono.CSharp.GlobalRootNamespace.LookupTypeReflection (Mono.CSharp.CompilerContext ctx, System.String name, Location loc, Boolean must_be_unique) [0x00000] in :0

at Mono.CSharp.Namespace.LookupType (Mono.CSharp.CompilerContext ctx, System.String name, Location loc) [0x00000] in :0

at Mono.CSharp.Namespace.Lookup (Mono.CSharp.CompilerContext ctx, System.String name, Location loc) [0x00000] in :0

at Mono.CSharp.TypeManager.CoreLookupType (Mono.CSharp.CompilerContext ctx, System.String ns_name, System.String name, Kind type_kind, Boolean required) [0x00000] in :0

at Mono.CSharp.TypeManager.InitCoreTypes (Mono.CSharp.CompilerContext ctx) [0x00000] in :0

at Mono.CSharp.Driver.Compile () [0x00000] in :0

at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0

 

I am currently using MySQL Connector Net 6.6.5, should I change to a different version?

Link to comment
Share on other sites

If not, it's been a few years so it's hard to remember exactly, but I believe I downloaded my functional version from here http://dev.mysql.com/downloads/connector/net/ If that doesn't work either I can share my functional code and .dll with you. Don't give up yet; I know for a fact that it's definitely possible to connect asp.net to mysql, because I've done it, and it still works just fine for me.

I'll post it for you when I'm not busy. I didn't figure it was so critical to get it posted immediately since you were in the middle of deleting and remaking your account.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...