diff --git a/Src/Asp.Net/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs b/Src/Asp.Net/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs index 9b56752c8..01153eb45 100644 --- a/Src/Asp.Net/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs +++ b/Src/Asp.Net/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs @@ -323,9 +323,16 @@ namespace SqlSugar { if (databaseDirectory != null) { - if (!FileHelper.IsExistDirectory(databaseDirectory)) + try { - FileHelper.CreateDirectory(databaseDirectory); + if (!FileHelper.IsExistDirectory(databaseDirectory)) + { + FileHelper.CreateDirectory(databaseDirectory); + } + } + catch + { + //Databases and sites are not in the same service } } var oldDatabaseName = this.Context.Ado.Connection.Database;