In my server saying "Could not load file or assembly 'MySql.Web..." but I have mysql in my application - mysql

Parser Error Message: Could not load file or assembly 'MySql.Web, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
...
Line 240: <providers>
Line 241: <add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.7.4.0,
.....
Resolved to putting the tag in the web.config file the following line:
<remove name="MySQLMembershipProvider"/>
I do not have access to the server settings to remove mysql. But there is another way to solve this that does not happen again?

I got this error when deploying a website to the server (but not when debugging).
To fix it, select References -> MySql.Data and set the Copy Local parameter to True. When deployed on the server you can verify this by the presence of the MySql.Data.dll in the bin folder.

Actually I believe if you remove or comment out the line with
<add name="MySQLRoleProvider" />
see http://forums.asp.net/t/1928379.aspx for more details.

This error appears in general when you provide the DLL-File in the wrong CPU-Type. So maybe you supplied x86 but you need x64. But I'm not an expert in web-development. I know this error from developing .net-Services.

secure_file_priv may be set as follows:
If empty, the variable has no effect.
If set to the name of a directory, the server limits import and export operations to work only with files in that directory. The directory must exist; the server will not create it.

Related

Different appsettings.json configuration for the same dotnet core program on the same server

I have dotnet core program that I would like to install 2 different configurations(development and test) of on the same server but using different appsettings.json files.
One needs to use appsettings.Development.json
The other must use appsettings.Test.json
Normally, appsettings.json are selected by looking up the value of the System variable called, DOTNET_ENVIRONMENT on the server.
Is there anyone who knows a method to deploy the same piece of software on the same server and there use different appsettings.json files?
There is else way to define the ASPNETCORE_ENVIRONMENT, in the we.config file.
If both exists (enviroment variable and in the web.config - the one in the web.config win because it more specific)
<configuration>
<system.webServer>
<aspNetCore processPath="D:\Dev\Example.exe" arguments="" stdoutLogEnabled="false" hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_HTTPS_PORT" value="443" />
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
<environmentVariable name="COMPLUS_ForceENC" value="1" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
To change the ASPNETCORE_ENVIRONMENT environmentVariable of the web.config while release there are some options, let me know if you want and I will post them.

SSMS 2014 Service provider must implement IVsDebugger interface

I'm getting the following errors when launching Microsoft SQL Server Management Studio 2014.
The 'VsDebugPresentationPackage, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' package did not load correctly.
The 'Microsoft.SqlServer.Management.SqlStudio, Microsoft.SqlServer.Management.SqlStudio, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' package did not load correctly.
The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by running the application together with the /log parameter on the command line, and then examining the file 'C:\Users\Leah\AppData\Roaming\Microsoft\AppEnv\10.0\ActivityLog.xml'.
I have checked the ActivityLog.xml and have found the following errors:
<entry>
<record>1063</record>
<time>2016/09/09 10:51:43.711</time>
<type>Error</type>
<source>VisualStudio</source>
<description>SetSite failed for package [Microsoft.SqlServer.Management.SqlStudio, Microsoft.SqlServer.Management.SqlStudio, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91]</description>
<guid>{04401FF3-8B0F-4D2D-85EB-2A3542867A8B}</guid>
<hr>80070057 - E_INVALIDARG</hr>
<errorinfo>Service provider must implement IVsDebugger interface</errorinfo>
</entry>
<entry>
<record>1064</record>
<time>2016/09/09 10:51:43.714</time>
<type>Error</type>
<source>VisualStudio</source>
<description>End package load [Microsoft.SqlServer.Management.SqlStudio, Microsoft.SqlServer.Management.SqlStudio, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91]</description>
<guid>{04401FF3-8B0F-4D2D-85EB-2A3542867A8B}</guid>
<hr>80070057 - E_INVALIDARG</hr>
<errorinfo>Service provider must implement IVsDebugger interface</errorinfo>
</entry>
This message has started appearing today after my PC black screened during windows updates. After several more black screens and further forced restarts, windows restored to a previous version and booted successfully. I have tried doing a fresh install of Microsoft SQL Server Management Studio 2014 but it hasn't changed the outcome.
This is the update that caused the black screens: Feature update to Windows 10, version 1607
Any help welcomed. Thanks.
Yes, it wasn't related to the update. My machine.config wasn't correct as I had put the connection string above config section in the machine.config.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config

Using ASP.NET with MySQL as default database?

Im creating a ASP.NET site, but i dont want to use SqlServer i want to use my pre-existing MySQL database as the default connection. ive set up a new schema for it and assigned a user, and changed my default connection string to this
<add name="DefaultConnection" connectionString="Server=THEIP;Database=THESCHEMANAME;Uid=THEUSER;Pwd=THEPASSWORD;" providerName="MySql.Data.MySqlClient" />
It seems to be able to connect to the DB alright (as far as i can tell?)
so now i figured i needed to change the default membership provider so that the login is ran through this connection, i did some looking around on the net and found this on the MySQL site
<add name="DefaultMembershipProvider" autogenerateschema="true" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.0.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="DefaultConnection" />
So i replaced my default membership provider with this, ran the site from Visual Studio, went to /Account/Register.aspx (every other page works alright as of yet) and i get this error
Could not load file or assembly 'MySql.Web, Version=6.0.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Can anybody point out what ive done wrong?
The version of the assembly was wrong, i went into the refrence assemblies and found that the version is not '6.0.4.0' but is infact '6.6.5.0', changed the version no. and its all working fine now.

How to use DbLinq SqlMetal for MySQL on Mac?

I'm using Mono/MonoDevelop on Mac OS, and I want an example for using SqlMetal (DbLinq version included with Mono) for LINQ-to-SQL with MySQL database.
Oddly, I found many examples for SQLite, but none for MySQL. Examples found for MySQL seems to refer to the Microsoft's SqlMetal.exe.
I tried to arrange my sqlmetal command from SQLite to adapt it for MySQL, but I have this message:
sqlmetal: Could not load databaseConnectionType type 'ByteFX.Data.MySqlClient.MySqlConnection, ByteFX.Data'. Try using the --with-dbconnection=TYPE option.
Help is appreciated! Thank you.
Find and edit your sqlmetal.exe.config and replace the settings not to use ByteFX (LONG unsupported) and use MySql.Data.
Remember to include the fully qualified assembly name, in my case that line looks like:
provider name="MySQL" dbLinqSchemaLoader="DbLinq.MySql.MySqlSchemaLoader, System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" databaseConnection="MySql.Data.MySqlClient.MySqlConnection, MySql.Data, Version=6.2.3.0, Culture=neutral, PublicKeyToken=2f3544035097bf97"
(I have MySql Connector installed with that version and token)
Regards
Download and install MySQL Connector/Net as per http://www.mono-project.com/MySQL
cd path_to_your MySql.Data.dll assembly
gacutil -i MySql.Data.dll
Browse to /Library/Frameworks/Mono.framework/Versions/2.10.12/lib/mono/gac/MySql.Data (or change the version number to match the version you're using) and you should see directories such as 6.6.5.0__c5687fc88969c44d
Open /Library/Frameworks/Mono.framework/Versions/2.10.12/lib/mono/4.0/sqlmetal.exe.config (or equivalent for the version you're using) and edit the databaseConnection attribute of the <provider name="MySQL" node as per BlackR2D's answer, using the properties from the folder in step 2 e.g. Version=6.6.5.0 and PublicKeyToken=c5687fc88969c44d
Make sure the path to the project you're running doesn't have a space in it or you may get a 'MonoDevelop.Database.Sql.SqlMetalExecException: sqlmetal: Could not find file' error
When you select 'Generate Linq Class' change the language to C# rather than C#2 otherwise you may get a 'MonoDevelop.Database.Sql.SqlMetalExecException: sqlmetal: Object reference not set to an instance of an object' error
I can then generate Output.cs, but still get an error if trying to generate DBML (Output.dbml):
'MonoDevelop.Database.Sql.SqlMetalExecException: sqlmetal: Access to the path "//Output.dbml" is denied'
I got this working on mono 2.10.2:
[mono-] ~ # sqlmetal /namespace:MonoService /provider:MySql "/conn:Server=[server];Database=[db];Uid=[name];Pwd=[pass];" /code:ProxyContext.cs --with-dbconnection="MySql.Data.MySqlClient.MySqlConnection, MySql.Data, Version=6.3.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
Before I put MySql.Data into the gac:
gacutil -i MySql.Data.dll

Shared Hosting + Entity Framework + MySQL = Data Provider Errors?

long-time listener, first-time caller!
I’m trying to connect to MySQL using the ADO.NET Entity Framework. (Visual Studio 2010, .NET 4.0) I created a web project and another class library project to serve as my DAL. On my local machine, I have no problems, and I have also tried running with Medium trust. I’m able to fully control the db as expected.
When I deploy to my host (shared, medium trust) however, I keep getting errors. I have tweaked my web.config multiple ways: I’ve explicitly called my assembly in the connection string, I’ve used the wildcard mapping, I added references to the MySQL dll’s, etc.
<connectionStrings>
<add name="NamespaceContext" connectionString="metadata=res:// Namespace.Data.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null/DataModel.csdl|res:// Namespace.Data.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null/DataModel.ssdl|res:// Namespace.Data.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null/DataModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=myserver;User Id=user;database=thedatabase;password=password;Persist Security Info=True"" providerName="System.Data.EntityClient"/>
<add name=" NamespaceContext " connectionString="metadata=res://*/;provider=MySql.Data.MySqlClient;provider connection string=" server=myserver;User Id=user;database=thedatabase;password=password;Persist Security Info=True"" providerName="System.Data.EntityClient"/>
<add name=" NamespaceContext " connectionString="metadata=res://*/DataModel.csdl|res://*/DataModel.ssdl|res://*/DataModel.msl;provider=MySql.Data.MySqlClient;provider connection string=" server=myserver;User Id=user;database=thedatabase;password=password;Persist Security Info=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
The error I keep getting is:
System.ArgumentException: The specified store provider cannot be found in the configuration, or is not valid. --->
System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
--- End of inner exception stack trace ---
at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
at MyNamespace.Web.Html.TestPage.EntityFrameworkTestButton_Click(Object sender, EventArgs e)
I talked to their support guys (who aren’t devs) but they said the MySQL connector is installed and in the GAC. I tried to use the DbProviderFactories section in my web.config, like the following:
<system.data>
<DbProviderFactories>
<clear/>
<remove invariant="MySql.Data.MySqlClient"/>
<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.3.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
I was hoping I could control this and reference the provider in my project. I then receive the following error:
System.Data.MetadataException: Schema specified is not valid.
Errors: error 0194: All artifacts loaded into an ItemCollection must have the same version. Multiple versions were encountered.
MySql.Data.Entity.Properties.SchemaDefinition-6.0.ssdl(4,9) : error 0169: All SSDL artifacts must target the same provider. The ProviderManifestToken '5' is different from '5.0' that was encountered earlier.
error 0194: All artifacts loaded into an ItemCollection must have the same version.
(lots of the same error message was snipped for brevity)
I am at a complete loss. I tried strongly signing my DAL project, not using a DAL and just creating the .edmx in the web project, all to no avail. I could have sworn I got it working at some point, but perhaps I was delirious.
Sorry for the wall o' text. Can anyone help or shed some light?
Thanks!
What happens if you put the mysql dll in your bin folder? Alternatively, try to remove the version restriction on the mysql dll, they may not have that exact version loaded on their servers.
I had a very similar problem in my application, where I was using the MySQL connector for a MySQL database and the Entity Framework for a SQL Server database (two separate connections, one project). The MySQL.Data.Entity DLL seems to fight with the entity framework. I didn't actually need it so I removed it... but the error persisted!
Finally out of desperation I just deleted my bin and obj folders and recompiled. Problem solved. I guess something was cached or hanging around in my folders, even after I ran a clean and rebuild. Something to try anyways if someone else runs into this.