How to publish a asp.net application with mysql - mysql

I'm developing a web application using asp.net and mysql. When i run it using visual studio it works fine. But when i'm trying to publish it following errors are coming.Please guide me what to do.
Message in Settings tab:
The database provider is not specified for this connection string. Incremental database publishing is supported only for SqlClient as well as Entity Framework code First models.

Related

ASP.NET Core 6 Web API : update database command on deployment

I am new to ASP.NET Core and using Entity Framework 6.
I have created a Web API using MySql. On development, I have executed add migrations and update-database command.
Now, I have published the Web API and I have to deploy it on a server. The server doesn't have development environment. I want to update the production database. How can I do this?`
I don't understand this : "The server doesn't have development environment."
You only have to replace Database ConnectionString of your project with ConnectionString of server, and then use update-database to update database.

Connecting to MySql on Docker

I have an ASP.NET 5 Web API application which I have deployed on docker. It connects to a MySql instance, also on docker. I am using Entity Framework 6 to connect to the MySql database. I have not referenced Entity Framework directly, but am using the MySql.Data.Entity package which internally uses Entity Framework 6.
When I invoke the API, I get this error:
Unable to determine the provider name for provider factory of type 'MySql.Data.MySqlClient.MySqlClientFactory'
Outside docker, i.e., on my windows machine, in Visual Studio 2015, I point my web API to the MySql instance on docker, and I can connect just fine. Inside docker, I get the error mentioned above.
What could be wrong?
The provider name is not being passed. Prior to ASP.NET 5 the provider value could be set alongside connectionString in in the web.config. This is no longer the case, as the connection string is just a string value in a json file with no extra properties.
You need to set it programatically. Here's an example, notably this part;
SetProviderServices("MySql.Data.MySqlClient", new MySqlProviderServices());
I'm not an expert on ASP.NET, but doesn't your question translate to:
If I run ASP.NET on Windows everything works fine, if I run it on
Linux I get an exception.
?
I don't think this is a Docker issue and would rather investigate about issues / driver needs the Entity Framework has on Mono.

Publishing ASP.NET MVC 4 Web Application with Mysql Database

I have successfully created a ASP.NET MVC 4 Web application and now I want to deploy it on a test environment. The target server is not an Azure server, but it is a Windows Server 2008 R2 Server with IIS installed in it.
Now I have published my solution using Visual Studio 2013 Professional, everything works fine excepts the Database. It's a Mysql Database that works perfectly with Entity Framework 5 (I have added the Mysql provider, mysql.data.entity.dll , mysql.data.dll on my web project and all the configuration to make it run locally). Once I publish the project, it is deployed on IIS but it doesn't retrieve data from my Mysql Database. I want to notice also that in the Publish wizard, although I specified the connection string, it says that
there is no Database detected
It should display the name of my context instead of that. Would you please help me know why the publishing wizard doesn't recognize my Mysql Database? thank you for your help !
I was able to use Asp.net MVC with MySql using Entity Framework code first, like the one explained here http://www.asp.net/identity/overview/getting-started/aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider ... Here a couple the things I notice:
The generated migration contains the schema dbo. that won't work on MySql so I went to the migration file and remove all schema references. (there are better solutions, like configuration/setup wise)
The unique key length problem, such as UserName (defined in the asp.net Identity) has a maximum length of 256 and that is over the limitations of mysql unique field, so I changed the length to 128. that solved this error
Specified key was too long; max key length is 767 bytes
I did have some troubles using the publishing wizard, since didn't show me any of my MySql Drivers to test my connection to my db, so I just change the Connection string in the config file and apply my migration changes to the new/testing DB from the Package Manager Console > Update-Database (this could be your temporary solution until you find a automatized solution)

Connecting Web API to SQL server 2008

I am fairly new to .net MVC 4 and WEB API. I need to connect my web API to SQL server 2008 but I'm not sure how exactly. I'll I have seen is examples using the local DB and I can't seem to find my solution.
You might also want to check out this blog post by Jason Zander. He includes a very nice step-by-step walkthrough of building a simple Tourist Attraction Application: My Favorite Features: Entity Framework Code First and ASP.NET Web API.
LocalDB is just another engine that is used to access a SQL server database file .mdf -- just like SQLExpress. Visual Studio 2012 uses LocalDB by default while Visual Studio 2010 uses SQLExpress. Anyhow, you can just replace the connection string used in the tutorial with your actual database connection string.
The following tutorial shows how to create a Web API project and connect to a data source using Entity Framework: msdn
It should give you the gist of what needs to be done.

Developing a Java web service using Jersey(JAX-RS), mySQL and Eclipse

I have successfully created Web Services from MySQL Database using Netbeans tutorial. However, I would like to develop similar web services using Eclipse IDE. Why Eclipse IDE? There are two reasons for that:
1) This is because i am using Tomcat 7.0 and JEE6. Unfortunately, NetBeans 7.0.1 implements Facade design pattern while using their “Create Web services from Database …” Wizard and it does not have a plugin for Tomcat 7 and EE6.
2) The NetBeans Wizard is helpful but does not help me understand details about using JDBC bridge, managing connections to MySQL DB and creating services to access the DB. Additionally, i want to add authorization for my services so that only registered users will be able to access my web services.
There's a very clear tutorial for building JAX-RS services in the Jersey user guide.
I found this tutorial that contains Restful web services using java and mysql in eclipse. It might be what you were looking for though it is a very simple tutorial. Check it out.
http://www.techpages.org/webservice/simple-restful-web-services-using-java-and-mysql-example/2009/