I have added a microservice service to a microservice solution. I followed the directions given in this doc: https://docs.abp.io/en/commercial/latest/startup-templates/microservice/add-microservice#running-the-solution
Then followed this doc: https://docs.abp.io/en/commercial/latest/startup-templates/microservice/synchronous-interservice-communication#updating-orderservice-application-contracts
Then did a migration and ran the project using:
tye run --watch
I am able to access the newly added end-point in swagger. But when I post data I get the error mentioned in the title.
The following is the trace.
Request starting HTTP/2 POST https://localhost:44337/api/app/product-type application/json 1122
2021-11-01 13:02:21.649 +04:00 [INF] Executing endpoint 'ZW.ProductSvc.ProductTypes.ProductTypeController.CreateAsync (ZW.ProductSvc.HttpApi)'
2021-11-01 13:02:21.660 +04:00 [INF] Route matched with {action = "Create", controller = "ProductType", area = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[System.Guid] CreateAsync(ZW.ProductSvc.ProductTypes.ProductTypeCreateDto) on controller ZW.ProductSvc.ProductTypes.ProductTypeController (ZW.ProductSvc.HttpApi).
2021-11-01 13:02:21.662 +04:00 [ERR] The required antiforgery cookie ".AspNetCore.Antiforgery.Schh12Bn9tQ" is not present.
2021-11-01 13:02:21.662 +04:00 [INF] Authorization failed for the request at filter 'Volo.Abp.AspNetCore.Mvc.AntiForgery.AbpAutoValidateAntiforgeryTokenAuthorizationFilter'.
2021-11-01 13:02:21.665 +04:00 [INF] Executing HttpStatusCodeResult, setting HTTP status code 400
2021-11-01 13:02:21.665 +04:00 [INF] Executed action ZW.ProductSvc.ProductTypes.ProductTypeController.CreateAsync (ZW.ProductSvc.HttpApi) in 5.2878ms
2021-11-01 13:02:21.665 +04:00 [INF] Executed endpoint 'ZW.ProductSvc.ProductTypes.ProductTypeController.CreateAsync (ZW.ProductSvc.HttpApi)'
2021-11-01 13:02:22.658 +04:00 [DBG] Added 0 entity changes to the current audit log
2021-11-01 13:02:22.658 +04:00 [DBG] Added 0 entity changes to the current audit log
2021-11-01 13:02:22.663 +04:00 [INF] Request finished HTTP/2 POST https://localhost:44337/api/app/product-type application/json 1122 - 400 0 - 1016.7524ms
Please let me know what might be causing this issue.
Thank you
29 Answer(s)
-
0
Do you want me to add a new microservice service to the template? I am sorry I didn't understand.
If you wanna check the existing copy I shared in github, you can just tye run that microservice solution and then post data into leave-type. Sample post data is in the github repo. When I post the data, I get the error, and I copied the error from the gateway logs.
I am not sure I understand what you want me to do, sorry; could you please elaborate.
Tx
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
hi
Create a new microservice project. Then use the simplest code to reproduce the problem.
Please use docker environment instead of your own database and redis etc..
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
hi liang,
creating a new microservice project is easy, but adding another service , then adding references that were not mentioned in the doc and taking reference from existing product-service etc. takes a long time to wire it up. Are you sure this is the only way out? Could you take remote and check, if that'd help?
Please let me know.
Thanks.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)