6 Answer(s)
-
0
-
0
Hi @Neozzz, as stated here if you add an app service method named
GetDocumentAsync
it will calculates as /api/app/file/{id}/document but if you would specified it likeGetAsync
it would have transformed it into /api/app/file/{id}.- If you want to customize your route calculation, you can check here.
Hi,
Thank you for the reply. I am trying to submit a file from the swaffer ui to my appservice:
public async Task<ObjectId> UploadImageAsync(IFormFile data) { bla bla return uploadSuccess; }
But I get the following warning:
System.IO.InvalidDataException: Missing content-type boundary.
Full log on request:
2021-06-29 09:57:29.330 +04:00 [DBG] Executing HealthCheck collector HostedService. 2021-06-29 09:57:29.331 +04:00 [INF] Entity Framework Core 5.0.1 initialized 'HealthChecksDb' using provider 'Microsoft.EntityFrameworkCore.InMemory' with options: StoreName=HealthChecksUI 2021-06-29 09:57:29.331 +04:00 [INF] Start processing HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:57:29.331 +04:00 [INF] Sending HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:57:29.349 +04:00 [INF] Request starting HTTP/1.1 GET https://localhost:44354/health-status - - 2021-06-29 09:57:29.350 +04:00 [INF] Executing endpoint 'Health checks' 2021-06-29 09:57:29.571 +04:00 [INF] Executed endpoint 'Health checks' 2021-06-29 09:57:29.572 +04:00 [INF] Request finished HTTP/1.1 GET https://localhost:44354/health-status - - - 200 - application/json 223.4216ms 2021-06-29 09:57:29.590 +04:00 [INF] Saved 2 entities to in-memory store. 2021-06-29 09:57:29.590 +04:00 [DBG] HealthReportCollector has completed. 2021-06-29 09:57:29.590 +04:00 [DBG] HealthCheck collector HostedService executed successfully. 2021-06-29 09:57:39.604 +04:00 [DBG] Executing HealthCheck collector HostedService. 2021-06-29 09:57:39.605 +04:00 [INF] Entity Framework Core 5.0.1 initialized 'HealthChecksDb' using provider 'Microsoft.EntityFrameworkCore.InMemory' with options: StoreName=HealthChecksUI 2021-06-29 09:57:39.605 +04:00 [INF] Start processing HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:57:39.605 +04:00 [INF] Sending HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:57:39.625 +04:00 [INF] Request starting HTTP/1.1 GET https://localhost:44354/health-status - - ] Received HTTP response headers after 268.7558ms - 200 2021-06-29 09:57:39.874 +04:00 [INF] End processing HTTP request after 268.9796ms - 200 2021-06-29 09:57:39.875 +04:00 [DBG] HealthReportCollector - health report execution history saved. 2021-06-29 09:57:39.875 +04:00 [DBG] HealthReport history already exists and is in the same state, updating the values. 2021-06-29 09:57:39.875 +04:00 [INF] Saved 2 entities to in-memory store. 2021-06-29 09:57:39.876 +04:00 [DBG] HealthReportCollector has completed. 2021-06-29 09:57:39.876 +04:00 [DBG] HealthCheck collector HostedService executed successfully. 2021-06-29 09:57:49.877 +04:00 [DBG] Executing HealthCheck collector HostedService. 2021-06-29 09:57:49.877 +04:00 [INF] Entity Framework Core 5.0.1 initialized 'HealthChecksDb' using provider 'Microsoft.EntityFrameworkCore.InMemory' with options: StoreName=HealthChecksUI 2021-06-29 09:57:49.877 +04:00 [INF] Start processing HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:57:49.877 +04:00 [INF] Sending HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:57:49.902 +04:00 [INF] Request starting HTTP/1.1 GET https://localhost:44354/health-status - - 2021-06-29 09:57:49.903 +04:00 [INF] Executing endpoint 'Health checks' 2021-06-29 09:57:50.121 +04:00 [INF] Executed endpoint 'Health checks' 2021-06-29 09:57:50.122 +04:00 [INF] Request finished HTTP/1.1 GET https://localhost:44354/health-status - - - 200 - application/json 220.8458ms 2021-06-29 09:57:50.137 +04:00 [INF] Received HTTP response headers after 259.7043ms - 200 2021-06-29 09:57:50.137 +04:00 [INF] End processing HTTP request after 259.8401ms - 200 2021-06-29 09:57:50.138 +04:00 [DBG] HealthReportCollector - health report execution history saved. 2021-06-29 09:57:50.138 +04:00 [DBG] HealthReport history already exists and is in the same state, updating the values. 2021-06-29 09:57:50.138 +04:00 [INF] Saved 2 entities to in-memory store. 2021-06-29 09:57:50.138 +04:00 [DBG] HealthReportCollector has completed. 2021-06-29 09:57:50.138 +04:00 [DBG] HealthCheck collector HostedService executed successfully. 2021-06-29 09:58:00.148 +04:00 [DBG] Executing HealthCheck collector HostedService. 2021-06-29 09:58:00.149 +04:00 [INF] Entity Framework Core 5.0.1 initialized 'HealthChecksDb' using provider 'Microsoft.EntityFrameworkCore.InMemory' with options: StoreName=HealthChecksUI 2021-06-29 09:58:00.149 +04:00 [INF] Start processing HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:58:00.149 +04:00 [INF] Sending HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:58:00.167 +04:00 [INF] Request starting HTTP/1.1 GET https://localhost:44354/health-status - - 2021-06-29 09:58:00.168 +04:00 [INF] Executing endpoint 'Health checks' 2021-06-29 09:58:00.388 +04:00 [INF] Executed endpoint 'Health checks' <**trunc**> 2021-06-29 09:58:10.679 +04:00 [INF] Saved 2 entities to in-memory store. 2021-06-29 09:58:10.679 +04:00 [DBG] HealthReportCollector has completed. 2021-06-29 09:58:10.679 +04:00 [DBG] HealthCheck collector HostedService executed successfully. 2021-06-29 09:58:20.695 +04:00 [DBG] Executing HealthCheck collector HostedService. 2021-06-29 09:58:20.695 +04:00 [INF] Entity Framework Core 5.0.1 initialized 'HealthChecksDb' using provider 'Microsoft.EntityFrameworkCore.InMemory' with options: StoreName=HealthChecksUI 2021-06-29 09:58:20.695 +04:00 [INF] Start processing HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:58:20.695 +04:00 [INF] Sending HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:58:20.714 +04:00 [INF] Request starting HTTP/1.1 GET https://localhost:44354/health-status - - 2021-06-29 09:58:20.716 +04:00 [INF] Executing endpoint 'Health checks' 2021-06-29 09:58:20.935 +04:00 [INF] Executed endpoint 'Health checks' 2021-06-29 09:58:20.935 +04:00 [INF] Request finished HTTP/1.1 GET https://localhost:44354/health-status - - - 200 - application/json 221.4764ms 2021-06-29 09:58:20.954 +04:00 [INF] Received HTTP response headers after 258.3474ms - 200 2021-06-29 09:58:20.954 +04:00 [INF] End processing HTTP request after 258.4655ms - 200 2021-06-29 09:58:20.954 +04:00 [DBG] HealthReportCollector - health report execution history saved. 2021-06-29 09:58:20.955 +04:00 [DBG] HealthReport history already exists and is in the same state, updating the values. 2021-06-29 09:58:20.955 +04:00 [INF] Saved 2 entities to in-memory store. 2021-06-29 09:58:20.955 +04:00 [DBG] HealthReportCollector has completed. 2021-06-29 09:58:20.955 +04:00 [DBG] HealthCheck collector HostedService executed successfully. 2021-06-29 09:58:30.986 +04:00 [DBG] Executing HealthCheck collector HostedService. 2021-06-29 09:58:30.986 +04:00 [INF] Entity Framework Core 5.0.1 initialized 'HealthChecksDb' using provider 'Microsoft.EntityFrameworkCore.InMemory' with options: StoreName=HealthChecksUI 2021-06-29 09:58:30.987 +04:00 [INF] Start processing HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:58:30.987 +04:00 [INF] Sending HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:58:31.007 +04:00 [INF] Request starting HTTP/1.1 GET https://localhost:44354/health-status - - 2021-06-29 09:58:31.008 +04:00 [INF] Executing endpoint 'Health checks' 2021-06-29 09:58:31.230 +04:00 [INF] Executed endpoint 'Health checks' 2021-06-29 09:58:31.231 +04:00 [INF] Request finished HTTP/1.1 GET https://localhost:44354/health-status - - - 200 - application/json 223.5154ms 2021-06-29 09:58:31.247 +04:00 [INF] Received HTTP response headers after 260.0129ms - 200 2021-06-29 09:58:31.247 +04:00 [INF] End processing HTTP request after 260.1302ms - 200 2021-06-29 09:58:31.247 +04:00 [DBG] HealthReportCollector - health report execution history saved. 2021-06-29 09:58:31.248 +04:00 [DBG] HealthReport history already exists and is in the same state, updating the values. 2021-06-29 09:58:31.248 +04:00 [INF] Saved 2 entities to in-memory store. 2021-06-29 09:58:31.248 +04:00 [DBG] HealthReportCollector has completed. 2021-06-29 09:58:31.248 +04:00 [DBG] HealthCheck collector HostedService executed successfully. 2021-06-29 09:58:39.011 +04:00 [INF] Request starting HTTP/2 POST https://localhost:44354/api/app/file/upload-image multipart/form-data;+boundary=----WebKitFormBoundary1Ka0lYzBxmaVzIHU 77459 2021-06-29 09:58:39.011 +04:00 [INF] CORS policy execution successful. 2021-06-29 09:58:39.027 +04:00 [INF] Executing endpoint 'ZW.FileSvc.Files.FileAppService.UploadImageAsync (ZW.FileSvc.Application)' 2021-06-29 09:58:39.027 +04:00 [INF] Route matched with {action = "UploadImage", controller = "File", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[MongoDB.Bson.ObjectId] UploadImageAsync(Microsoft.AspNetCore.Http.IFormFile) on controller ZW.FileSvc.Files.FileAppService (ZW.FileSvc.Application). 2021-06-29 09:58:39.464 +04:00 [ERR] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "An internal error occurred during your request!", "details": null, "data": { "ActivatorChain": "Castle.Proxies.FileAppServiceProxy" }, "validationErrors": null } 2021-06-29 09:58:39.464 +04:00 [ERR] An exception was thrown while activating Castle.Proxies.FileAppServiceProxy. Autofac.Core.DependencyResolutionException: An exception was thrown while activating Castle.Proxies.FileAppServiceProxy. ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Volo.Abp.Autofac.AbpAutofacConstructorFinder' on type 'Castle.Proxies.FileAppServiceProxy' can be invoked with the available services and parameters: Cannot resolve parameter 'ZW.FileSvc.Files.IFileRepository fileRepository' of constructor 'Void .ctor(Castle.DynamicProxy.IInterceptor[], ZW.FileSvc.Files.IFileRepository)'. at Autofac.Core.Activators.Reflection.ReflectionActivator.GetAllBindings(ConstructorBinder[] availableConstructors, IComponentContext context, IEnumerable`1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext ctxt, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next) --- End of inner exception stack trace --- at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next) <**trunc**> at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request) at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) at Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext) at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 2021-06-29 09:58:39.464 +04:00 [ERR] ---------- Exception Data ---------- ActivatorChain = Castle.Proxies.FileAppServiceProxy 2021-06-29 09:58:39.465 +04:00 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.Http.RemoteServiceErrorResponse'. 2021-06-29 09:58:39.465 +04:00 [INF] Executed action ZW.FileSvc.Files.FileAppService.UploadImageAsync (ZW.FileSvc.Application) in 437.8322ms 2021-06-29 09:58:39.465 +04:00 [INF] Executed endpoint 'ZW.FileSvc.Files.FileAppService.UploadImageAsync (ZW.FileSvc.Application)' 2021-06-29 09:58:39.686 +04:00 [INF] Request finished HTTP/2 POST https://localhost:44354/api/app/file/upload-image multipart/form-data;+boundary=----WebKitFormBoundary1Ka0lYzBxmaVzIHU 77459 - 500 - application/json;+charset=utf-8 675.3065ms 2021-06-29 09:58:41.266 +04:00 [DBG] Executing HealthCheck collector HostedService. 2021-06-29 09:58:41.266 +04:00 [INF] Entity Framework Core 5.0.1 initialized 'HealthChecksDb' using provider 'Microsoft.EntityFrameworkCore.InMemory' with options: StoreName=HealthChecksUI 2021-06-29 09:58:41.267 +04:00 [INF] Start processing HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:58:41.267 +04:00 [INF] Sending HTTP request GET "https://localhost:44354/health-status" 2021-06-29 09:58:41.286 +04:00 [INF] Request starting HTTP/1.1 GET https://localhost:44354/health-status - - 2021-06-29 09:58:41.287 +04:00 [INF] Executing endpoint 'Health checks' 2021-06-29 09:58:41.506 +04:00 [INF] Executed endpoint 'Health checks' 2021-06-29 09:58:41.507 +04:00 [INF] Request finished HTTP/1.1 GET https://localhost:44354/health-status - - - 200 - application/json 221.2138ms
Also there looks to be dependency injection error. So I'll give some context to the issue in the next thread.
-
0
What we're trying to do here is to use gridfs for storing files. And for that we dont require creating an entity. So there are some definitions we've to make at the several layers:
For example, usually in the case of having an entity: public class MongoDbFileRepository :MongoDbRepository<BookStoreMongoDbContext, Author, Guid>, IFileRepository
In our case we just used: public class MongoDbFileRepository : IFileRepository
Could this be the cause of the dependency injection error?
Is there any reference or example where we just capture data from from api and not use any entities?
Please help.
Thank you.
-
1
Hi, you can use
IRemoteStreamContent
for file upload & download actions.https://docs.abp.io/en/abp/latest/Application-Services#working-with-streams
-
0
What we're trying to do here is to use gridfs for storing files. And for that we dont require creating an entity. So there are some definitions we've to make at the several layers:
For example, usually in the case of having an entity: public class MongoDbFileRepository :MongoDbRepository<BookStoreMongoDbContext, Author, Guid>, IFileRepository
In our case we just used: public class MongoDbFileRepository : IFileRepository
Could this be the cause of the dependency injection error?
Is there any reference or example where we just capture data from from api and not use any entities?
Please help.
Thank you.
About this issue,
You can consider to create your own BLOB Provider. As you mentioned you want to use it for files.
Here are detailed documentations.
-
0
This question has been automatically marked as stale because it has not had recent activity.