My WPF application does not start on another PC, while an application with no MySql works, what could be the problem?

fjaof16o  于 2022-12-22  发布在  Mysql
关注(0)|答案(1)|浏览(121)

This is my first using a database. I've made an application that contains tables in dbForge through mySql localhost with XAMPP. I copied all my files and downloaded the latest 6.0 framework on the other PC, but it does not start, and it is not giving any error messages. Furthermore, I can see in the Task Manager that it opens for some seconds and then closes.
Also, I tried it with a different application without mySql and that application started. What common mistakes could I have? I can provide more information, if needed, but right now I can't tell what should I be even checking.
The connection code block:

public class ApplicationDbContext : DbContext
{
    public DbSet<Berletes> Berletesek { get; set; }
   
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        var connetionString = "Server=localhost; Database=foxgymapp; Uid=root; Pwd=;";
        optionsBuilder.UseMySql(connetionString, ServerVersion.AutoDetect(connetionString));
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
    }
}
yfwxisqw

yfwxisqw1#

The problem you have is that you trying to access a database in that doesn't exist.
You are pointing to a DB in localhost, which is hosted in your computer, you would to run the same DB in the other machine or expose your DB from your computer to the other one.

相关问题