hi
is it because Abp gateway's auto feature?
Is your project a microservice? Otherwise, it does not have a gateway project. Do you use a reverse proxy?
Yes, it is Micro Service project. I modify settings to this: "QoSOptions": { "ExceptionsAllowedBeforeBreaking": 1, "DurationOfBreak": 1000, "TimeoutValue": 1200000 } Seems work as expected locally. But not deployed site yet. I also met a very weird null reference exception at the line, _entityAppServe.GetById (uniqueId); which _entityAppService is a App Service in another Micro Service, it means _entityAppService is null, it is not always happen, but occasionally happens, I don't understand why.
Now I suspect it is because that Request Time out settings of .Host project, I tested locally, since change the settings, has no impact. Locally testing can always process large data, but for deployed code, the application throw exception at certain amount of data. I also noticed that the request is triggered again when first request failed, is it because Abp gateway's auto feature?
Hi @maiiming,
I sent you exception call stack via email.
The code disable entrance API's unit of work, because the whole process involves other resources access which might take long time, wrap data access code by unit of work at the steps need to access database.
Thanks, Domina
When Angular calls API which trigger a long operational call, the entrance App Service method has [UnitOfWork(IsDisabled = true)]. This App Service call several other App Services. Within these App Services there are several places need to access/update MongdoDb, for those data access, use code below:
using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
{
...
await uow.CompleteAsync();
}
But still MongoDb throw exception. For these App Services Methods called by entrance App Service, do I need to add [UnitOfWork(IsDisabled = true)] annotation too? Thanks,
at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ProcessResponse (MongoDB.Driver.Core, Version=2.15.1.0, Culture=neutral, PublicKeyToken=null)
at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1+<ExecuteAsync>d__20.MoveNext (MongoDB.Driver.Core, Version=2.15.1.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at MongoDB.Driver.Core.Servers.Server+ServerChannel+<ExecuteProtocolAsync>d__20`1.MoveNext (MongoDB.Driver.Core, Version=2.15.1.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at MongoDB.Driver.Core.Operations.RetryableReadOperationExecutor+<ExecuteAsync>d__3`1.MoveNext (MongoDB.Driver.Core, Version=2.15.1.0, Culture=neutral, PublicKeyToken=null)
...
at Volo.Abp.Auditing.AuditingInterceptor+<InterceptAsync>d__2.MoveNext (Volo.Abp.Auditing, Version=7.2.1.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1+<InterceptAsync>d__3`1.MoveNext (Volo.Abp.Castle.Core, Version=7.2.1.0, Culture=neutral, PublicKeyToken=null)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Castle.DynamicProxy.AsyncInterceptorBase+<ProceedAsynchronous>d__14`1.MoveNext (Castle.Core.AsyncInterceptor, Version=2.1.0.0, Culture=neutral,
From Angular App, console: POST https://localhost:44325/signalr-hubs/messaginghub/negotiate?negotiateVersion=1 502
From Gateway log: web-gateway_4420d4f8-1]: [13:53:47 DBG] requestId: 0HMT7TSEGNSB6:0000000D, previousRequestId: no previous request id, message: Downstream url is http://localhost:45186/signalr-hubs/messaginghub/negotiate?negotiateVersion=1 [web-gateway_4420d4f8-1]: [13:53:47 DBG] requestId: 0HMT7TSEGNSB6:0000000D, previousRequestId: no previous request id, message: IHttpRequester returned an error, setting pipeline error [web-gateway_4420d4f8-1]: [13:53:47 WRN] requestId: 0HMT7TSEGNSB6:0000000D, previousRequestId: no previous request id, message: Error Code: ConnectionToDownstreamServiceError Message: Error connecting to downstream service, exception: System.Net.Http.HttpRequestException: An error occurred while sending the request. [web-gateway_4420d4f8-1]: ---> System.IO.IOException: The response ended prematurely.
Do you have a sample code for SignalR send message to Angular app. Angular get 502 for negociate.
In Micro Service Application module: typeof(AbpAutoMapperModule),
Configure<AbpSignalROptions>(options =>
{
options.Hubs.AddOrUpdate(
typeof(NotificationHub), //Hub type
config => //Additional configuration
{
config.ConfigureActions.Add(hubOptions =>
{
//Additional options
hubOptions.LongPolling.PollTimeout = TimeSpan.FromSeconds(30);
});
}
);
});
In Gateway module:
app.UseWebSockets();
app.UseOcelot().Wait();
app.UseRouting()
{
"ServiceKey": "SignalR Service",
"DownstreamPathTemplate": "/signalr-hubs/{evertything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 45186
}
],
"UpstreamHttpMethod": [ "POST" ],
"UpstreamPathTemplate": "/signalr-hubs/{evertything}",
"ReRouteIsCaseSensitive": false
},
{
"ServiceKey": "SignalR Service",
"DownstreamPathTemplate": "/signalr-hubs/{everything}",
"ReRouteIsCaseSensitive": false,
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 45186
}
],
"UpstreamPathTemplate": "/signalr-hubs/{anyHub}",
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE", "OPTIONS" ]
},
Figured out the reason. It is because of wrong grand type setting (should use grand type "code", but the angular app users resource owner.
Hi Ming,
With Dev Tools, we check network traffic and cookies, current tenant's Id is null. That is why this ticket is raised. But Developer local debugging, everything seems fine.
Thanks, Domina
The abp sample code that get access token works (https://github.com/bartvanhoey/), I tested that both client credential and resource owner grant type work.
It might because the app already use Rabbit MQ as service bus. Ignore this ticket.