You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Anunhandledexceptionhasoccurredwhileexecutingtherequest.System.IO.FileNotFoundException: Could not loadfileorassembly'ZhangPengFei.IoT.ApiService.Model, Culture=neutral, PublicKeyToken=null'.系统找不到指定的文件。Filename: 'ZhangPengFei.IoT.ApiService.Model, Culture=neutral, PublicKeyToken=null'atSystem.Reflection.RuntimeAssembly.InternalLoad(AssemblyNameassemblyName,StackCrawlMark& stackMark,AssemblyLoadContextassemblyLoadContext,RuntimeAssemblyrequestingAssembly,BooleanthrowOnFileNotFound)atSystem.Reflection.Assembly.Load(StringassemblyString)atSqlSugar.CodeFirstProvider.InitTables(StringentitiesNamespace)atZhangPengFei.IoT.ApiService.DataBase.DataBaseManager.BuildWithMySQL()inC:\Users\doudo\RiderProjects\Aspire.IoT\AspireIoT\ZhangPengFei.IoT.ApiService\DataBase\DataBaseManager.cs:line40atZhangPengFei.IoT.ApiService.EndPoints.GateWayEndPoints.Services.GateWayService..ctor(MySqlDataSourcedataSource)inC:\Users\doudo\RiderProjects\Aspire.IoT\AspireIoT\ZhangPengFei.IoT.ApiService\EndPoints\GateWayEndPoints\Services\GateWayService.cs:line11atSystem.RuntimeMethodHandle.InvokeMethod(Objecttarget,Void** arguments,Signaturesig,BooleanisConstructor)atSystem.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Objectobj,Span`1 copyOfArgs, BindingFlags invokeAttr) at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSitecallSite,TArgumentargument)atMicrosoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSitetransientCallSite,RuntimeResolverContextcontext)atMicrosoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSitecallSite,TArgumentargument)atMicrosoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSitecallSite,ServiceProviderEngineScopescope)atMicrosoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScopescope)atMicrosoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifierserviceIdentifier,ServiceProviderEngineScopeserviceProviderEngineScope)atMicrosoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(TypeserviceType)atMicrosoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProviderprovider,TypeserviceType)atlambda_method4(Closure,Object,HttpContext)atMicrosoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.Invoke(HttpContextcontext)
临时解决方案
Db.DbMaintenance.CreateDatabase();//todo: bugSystem.IO.FileNotFoundException: Could not loadfileorassembly//Db.CodeFirst.InitTables(@"ZhangPengFei.IoT.ApiService.Model");//todo: fixinittablesAssemblyassembly=Assembly.GetExecutingAssembly();vartypes=assembly.GetTypes().Where(t=>t.Namespace == typeof(GateWay).Namespace).ToArray();Db.CodeFirst.InitTables(types);
The text was updated successfully, but these errors were encountered:
PSC-F
changed the title
bug 在调用 Db.CodeFirst.InitTables(@"xxx.xxx.models"); 显示System.IO.FileNotFoundException: Could not load file or assembly
在调用 Db.CodeFirst.InitTables(@"xxx.xxx.models"); 显示System.IO.FileNotFoundException: Could not load file or assembly
Apr 25, 2024
Warning
在Aspire 中引入 SqlSugar 初始化数据库表结构,调用按指定命名空间初始化表时找不到程序集
The text was updated successfully, but these errors were encountered: