stepanbenes / api-for-nopcommerce

API plugin for nopCommerce 4.50
MIT License
141 stars 93 forks source link

installation problem on 4.40.4 #49

Closed muhammedtas closed 9 months ago

muhammedtas commented 3 years ago

Hello.

I tried to install this plugin as you documented.

It seems like installable on admin panel. I activated it.

But then application started to crash on startup, by saying someting like "System.IO.FİleNotFoundException" for Microsoft.IdentityModel.Tokens Version 5.5.0.0, and also for Microsoft.IdentityModel.Logging dlls.

I've investigated the problem a little bit and I saw that, in build time, some of the dll's in your plugin was not installed to Nop.Web/Plugins/bin folder. Then when NopEngine.cs tries inject plugin's interfaces to application via reflection, it failes to resolve dependencies.

On top of that my current nopcommerce version has Microsoft.IdentityModels.Tokens version as 5.2.4.0 but this plugin has 5.5.0.0

Do you have any suggestion for my problem?

mtugnoli commented 3 years ago

I have a similar problem, in my pc is installed to Nop.Web/Plugins/bin folder but program stay in program.cs -> await host.StartAsync();

muhammedtas commented 3 years ago

@mtugnoli it may be the same problem. Because what StartAsnyc() class does is to call ConfigureService methods and the others. For my case the breaking line is => (NopEngine.cs line : 152 - instance.ConfigureServices(services, configuration);)

If I am not wrong the missing dlls are => Microsoft.IdentityModel.Tokens and Microsoft.IdentityMode.Logging version 5.5.5.0

Some how application is not installing these dlls to Plugin/bin folder. Because PluginManager.cs class decides to not install these dlls to target folder, because of its behaviour that I am not aware of for now.

Then I've Downgrade Microsoft.AspNetCore.Authentication.JwtBearer nuget to version 2.1.30. Now application is running. Web api plugin is shown as "Installed"

I hope it helps

mtugnoli commented 3 years ago

@muhammedtas in my case, after compiled the plugin all dll seem in the target folder, but after installed (from button on admin section), i restart the app and no one error, but debug remain in await host.StartAsync(); and all seem locked

muhammedtas commented 3 years ago

@mtugnoli Did you try installing this plugin, by copying it to directly NopCommerce/Plugins folder?

What I did after fixing my problem is that, I copied api pluging to where the others are in. Then update its .csproj file. Then build it. Now its running quite stable.

image
HeroSpha commented 2 years ago

@muhammedtas im trying to follow the documentation i can see the API is generated under Nop.Web plugins but its not available under admin local plugins. Can you help what might be the problem?

jacobuslee commented 2 years ago

I installed the API plugin. May I ask where I can obtain API Token? Thanks

stepanbenes commented 2 years ago

@jacobuslee use POST request to /token endpoint. See swagger UI or /Nop.Plugin.Api/Controllers/TokenController.cs.

HeroSpha commented 2 years ago

Good day, i managed to generate the files but they dont contain csproj file. Is my folder contents correct?

image

HeroSpha commented 2 years ago

Actually im not seeing any installed pluggin in my admin local plugins

jacobuslee commented 2 years ago

I installed "api-for-nopcommerce 4.40.4" in the past, and now I want to download it again and read the instruction. Is "api-for-nopcommerce 4.40.4" no longer available now?

jacobuslee commented 2 years ago

Do I also need to add "Api Users" Role to User in "api-for-nopcommerce 4.40.4" because I cannot find "Api Users" Role option in the API Plugin.

jacobuslee commented 2 years ago

The token can be obtain, so the traffic is fine. However, API calls are forbidden. Does anyone know what the issue is?

jacobuslee commented 2 years ago

I found the solution. Thanks

D3bo commented 9 months ago

I found the solution. Thanks