Home > Net >  Abp dynamic WebApi great god grant instruction
Abp dynamic WebApi great god grant instruction

Time:11-05

(a) the SDK version
1. MicroSoft.net Core SDK 2.2.100 (X64)
2. MicroSoft.net Core SDK 3.1.403 (X64) from Visual Studio
3. The MicroSoft.net Framework 4.8

(2) development tool
Visual Studio 2019

(3) the project background
Before and after the separation reform of the existing system,
system USES the existing framework of Abp , the goal is to the traditional Web project, before and after the transformation become separate projects,

(4) technical direction
Plans to use the dynamics of Abp WebApi
The official document: https://www.52abp.com/Wiki/abp-cn/latest/5.2ABP%E5%88%86%E5%B8%83%E5%BC%8F%E6%9C%8D%E5%8A%A1-%E5%8A%A8%E6%80%81WebApi%E5%B1%82

According to the official document, the method is simple, simply add the following code in the Model, but did not succeed,

 
Public class AbpProjectNameWebApiModule: AbpModule
{
Public override void the Initialize ()
{
IocManager. RegisterAssemblyByConvention (Assembly. GetExecutingAssembly ());

The Configuration. Modules. AbpWebApi (.) DynamicApiControllerBuilder
. ForAll (typeof (AbpProjectNameApplicationModule). The Assembly, "app")
The Build ();
}
}


(5) problem description
Apb framework of dynamic WebApi, the following problems
1. The first is NuGet install Apb. Web. Api Package, installation, start the service, make a mistake, basic it is cannot load a component, is as follows:
 
System. IO. FileNotFoundException
HResult=0 x80070002
Message=Could not load file or assembly 'Abp. Web Version=4.3.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the specified file,
The Source=System. Private. CoreLib
StackTrace:
Ats System. Reflection. CustomAttribute. _CreateCaObject (RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte * * ppBlob, Byte * pEndBlob, Int32 * pcNamedArgs)
Ats System. Reflection. CustomAttribute. CreateCaObject (RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& Blob, IntPtr blobEnd, Int32 & amp; NamedArgs)
Ats System. Reflection. CustomAttribute. GetCustomAttributes (RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
Ats System. Reflection. CustomAttribute. GetCustomAttributes (RuntimeType type, RuntimeType caType, Boolean inherit)
The at Abp. Modules. AbpModule. FindDependedModuleTypes (Type moduleType)
The at Abp. Modules. AbpModule. AddModuleAndDependenciesRecursively (List ` 1 Modules, Type module)
The at Abp. Modules. AbpModule. AddModuleAndDependenciesRecursively (List ` 1 Modules, Type module)
The at Abp. Modules. AbpModule. AddModuleAndDependenciesRecursively (List ` 1 Modules, Type module)
The at Abp. Modules. AbpModule. AddModuleAndDependenciesRecursively (List ` 1 Modules, Type module)
The at Abp. Modules. AbpModule. FindDependedModuleTypesRecursivelyIncludingGivenModule (Type moduleType)
The at Abp. Modules. AbpModuleManager. FindAllModuleTypes (List ` 1 & amp; PlugInModuleTypes)
The at Abp. Modules. AbpModuleManager. LoadAllModules ()
The at Abp. AbpBootstrapper. The Initialize ()


2. Continue to install the Abp. Web, or the lack of other Package, lack what fill what, total installed 4, the following


3. The last out of such a problem, investigation, there is no any information on the net, a great god grant instruction
 
System. TypeLoadException
HResult=0 x80131522
Message=Could not load type 'System. Web. HttpPostedFileBase' from the assembly 'System. Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Source=Abp. Web
StackTrace:
The at Abp. Web. AbpWebModule. AddIgnoredTypes ()
Ats System. Collections. Generic. List ` 1. ForEach (Action ` 1 Action)
The at Abp. Modules. AbpModuleManager. StartModules ()
The at Abp. AbpBootstrapper. The Initialize ()
The at Abp. AspNetCore. AbpApplicationBuilderExtensions. InitializeAbp (IApplicationBuilder app)
At Abp. AspNetCore. AbpApplicationBuilderExtensions. UseAbp (IApplicationBuilder app, Action ` 1 optionsAction)


(6) other
Everyone a great god grant instruction,
Or for the project, there are other solutions please give directions, thank,

CodePudding user response:

I remember, webapi directly added in the application,
Main remember inheritance IApplicationService interface,
https://blog.csdn.net/hanjun0612/article/details/108765581
  • Related