Home > Software design >  SSL provide error: When I run my API code then I founded a runtime error
SSL provide error: When I run my API code then I founded a runtime error

Time:11-17

**Microsoft.Data.SqlClient.SqlException **(0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.) System.ComponentModel.Win32Exception (0x80090325): The certificate chain was issued by an authority that is not trusted. at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

using WebApplication2.Data;
using WebApplication2.Model.Domain;


namespace WebApplication2.Repositories
{
    public class RegionRepository : IRegionRepository
    {
        private readonly WalksDbContext walksDbContext;
        public RegionRepository(WalksDbContext walksDbContext)
        {
            this.walksDbContext = walksDbContext;
        }
        public IEnumerable<Region> GetAll()
        {
            return walksDbContext.Regions.ToList();
        }
    }
}

CodePudding user response:

I used local database so SSL provide error is resolved. my local database name is (localdb)\MSSQLLocalDB and also change in appsetting.json like this

    { 
     "Logging": {
         "LogLevel": { 
            "Default": "Information",
            "Microsoft.AspNetCore": "Warning"
      }
 },
 "AllowedHosts": "*",
 "ConnectionStrings": {
    "NzWalks": "server=
 (localdb)\\MSSQLLocalDB;database=NzWalksDb;trusted_connection=true"
 }
}
  • Related