Thought, you may want to see the startup.cs file.
public IServiceProvider ConfigureServices(IServiceCollection services)
{
//MVC
services.AddControllersWithViews(options =>
{
options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());
}).AddNewtonsoftJson();
services.AddSignalR(options => { options.EnableDetailedErrors = true; });
//Azure:SignalR:ConnectionString is the default configuration key that SignalR looks for to establish a connection.
//services.AddSignalR().AddAzureSignalR(@"Endpoint=https://ivendwebsignalr.service.signalr.net;AccessKey=+oTw1tBp2lEbDpJ2e/Pyl3LKreDfqQfvNEemaOPFOmo=;Version=1.0;");
//Configure CORS for angular2 UI
services.AddCors(options =>
{
options.AddPolicy(DefaultCorsPolicyName, builder =>
{
//App:CorsOrigins in appsettings.json can contain more than one address with splitted by comma.
builder
.WithOrigins(
// App:CorsOrigins in appsettings.json can contain more than one address separated by comma.
_appConfiguration["App:CorsOrigins"]
.Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.RemovePostFix("/"))
.ToArray()
)
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
IdentityRegistrar.Register(services);
AuthConfigurer.Configure(services, _appConfiguration);
//Identity server
if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"]))
{
IdentityServerRegistrar.Register(services, _appConfiguration, options =>
options.UserInteraction = new UserInteractionOptions()
{
LoginUrl = "/UI/Login",
LogoutUrl = "/UI/LogOut",
ErrorUrl = "/Error"
});
}
if (WebConsts.SwaggerUiEnabled)
{
//Swagger - Enable this line and the related lines in Configure method to enable swagger UI
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo() { Title = "iVend API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.ParameterFilter<SwaggerEnumParameterFilter>();
options.SchemaFilter<SwaggerEnumSchemaFilter>();
options.OperationFilter<SwaggerOperationIdFilter>();
options.OperationFilter<SwaggerOperationFilter>();
options.CustomDefaultSchemaIdSelector();
});
}
//Recaptcha
services.AddRecaptcha(new RecaptchaOptions
{
SiteKey = _appConfiguration["Recaptcha:SiteKey"],
SecretKey = _appConfiguration["Recaptcha:SecretKey"]
});
//if (WebConsts.HangfireDashboardEnabled)
//{
// //Hangfire(Enable to use Hangfire instead of default job manager)
// services.AddHangfire(config =>
// {
// config.UseSqlServerStorage(_appConfiguration.GetConnectionString("Default"));
// });
//}
if (WebConsts.GraphQL.Enabled)
{
services.AddAndConfigureGraphQL();
services.AddSingleton<QueryContainer>();
}
if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
{
services.AddAbpZeroHealthCheck();
var healthCheckUISection = _appConfiguration.GetSection("HealthChecks")?.GetSection("HealthChecksUI");
if (bool.Parse(healthCheckUISection["HealthChecksUIEnabled"]))
{
services.Configure<HealthChecksUISettings>(settings =>
{
healthCheckUISection.Bind(settings, c => c.BindNonPublicProperties = true);
});
services.AddHealthChecksUI();
}
}
//Configure Abp and Dependency Injection
return services.AddAbp<iVendWebHostModule>(options =>
{
//Configure Log4Net logging
options.IocManager.IocContainer.AddFacility<LoggingFacility>(
f => f.UseAbpLog4Net().WithConfig("log4net.config")
);
options.PlugInSources.AddFolder(Path.Combine(_hostingEnvironment.WebRootPath, "Plugins"), SearchOption.AllDirectories);
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
Clock.Provider = ClockProviders.Utc;
//Initializes ABP framework.
app.UseAbp(options =>
{
options.UseAbpRequestLocalization = false; //used below: UseAbpRequestLocalization
});
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseStatusCodePagesWithRedirects("~/Error?statusCode={0}");
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseCors(DefaultCorsPolicyName); //Enable CORS!
app.UseAuthentication();
//app.UseAuthorization();
app.UseJwtTokenMiddleware();
if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"]))
{
//app.UseJwtTokenMiddleware("IdentityBearer");
app.UseIdentityServer();
}
app.UseAuthorization();
using (var scope = app.ApplicationServices.CreateScope())
{
if (scope.ServiceProvider.GetService<DatabaseCheckHelper>().Exist(_appConfiguration["ConnectionStrings:Default"]))
{
app.UseAbpRequestLocalization();
}
}
//if (WebConsts.HangfireDashboardEnabled)
//{
// //Hangfire dashboard &server(Enable to use Hangfire instead of default job manager)
// app.UseHangfireDashboard(WebConsts.HangfireDashboardEndPoint, new DashboardOptions
// {
// Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) }
// });
// app.UseHangfireServer();
//}
if (bool.Parse(_appConfiguration["Payment:Stripe:IsActive"]))
{
StripeConfiguration.ApiKey = _appConfiguration["Payment:Stripe:SecretKey"];
}
if (WebConsts.GraphQL.Enabled)
{
app.UseGraphQL<MainSchema>();
if (WebConsts.GraphQL.PlaygroundEnabled)
{
app.UseGraphQLPlayground(
new GraphQLPlaygroundOptions()); //to explorer API navigate https://*DOMAIN*/ui/playground
}
}
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<AbpCommonHub>("/signalr");
//endpoints.MapHub<ChatHub>("/signalr-chat");
//endpoints.MapHub<IVendWebHub>("/ivendwebhub");
endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
{
endpoints.MapHealthChecks("/healthz", new HealthCheckOptions()
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
}
});
if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
{
if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksUI:HealthChecksUIEnabled"]))
{
app.UseHealthChecksUI();
}
}
if (WebConsts.SwaggerUiEnabled)
{
// Enable middleware to serve generated Swagger as a JSON endpoint
app.UseSwagger();
// Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint(_appConfiguration["App:SwaggerEndPoint"], "Tagrain API V1");
options.IndexStream = () => Assembly.GetExecutingAssembly()
.GetManifestResourceStream("CitiXsys.iVend.Web.wwwroot.swagger.ui.index.html");
options.InjectBaseUrl(_appConfiguration["App:ServerRootAddress"]);
}); //URL: /swagger
}
}
I revert the Azure's CORS policy back. see the screen shot below. Earlier Enable Access-Control-Allow-Credentials was ticked.
Below is the setting of AZPNetZero's CORS.
Now when we browse the site then after login we get the CORS error. Please see below screen shot. This error was not coming till the time we had not enabled the signalR.
Thanks....much appreciated....
Hi Expert,
I have added the singleton dependency see the bold line below and I get the optimum performance now. Is the following changes ok? Please confirm.
if (WebConsts.GraphQL.Enabled) { services.AddAndConfigureGraphQL(); services.AddSingleton<QueryContainer>(); }
Hi,
Just to let you know, below is my QueryContainer class. I have many GraphQL queries inside it. If I comment all and leave one (the one I'll query) say if I leave "ProductQuery productQuery" uncommented and comment the rest, then it works fast. But if I have all the below queries uncommented then, it becomes slow.
Any hint would be appreciated.. Regards, Mahendra
using Abp.Dependency; using GraphQL.Types;
namespace CitiXsys.iVend.Queries.Container
{
public sealed class QueryContainer : ObjectGraphType, ITransientDependency
{
public QueryContainer(RoleQuery roleQuery,
UserQuery userQuery,
OrganizationUnitQuery organizationUnitQuery,
AuditLogQuery auditLogQuery,
ProductQuery productQuery,
TeamQuery teamQuery,
VendorGroupQuery vendorGroupQuery,
RetailProfileQuery retailProfileQuery,
FulfillmentQuery fulfillmentQuery,
SurchargeQuery surchargeQuery,
WarehouseQuery warehouseQuery,
ManufacturerQuery manufacturerQuery,
CountryQuery countryQuery,
BankQuery bankQuery,
DepartmentQuery departmentQuery,
JobCodeQuery jobCodeQuery,
ReasonCodeQuery reasonCodeQuery,
BarCodeMaskQuery barCodeMaskQuery,
ShippingTypeQuery shippingTypeQuery,
ProductGroupQuery productGroupQuery,
RetailEventQuery retailEventQuery,
RetailMessageQuery retailMessageQuery,
POSQuery cashRegisterQuery,
CurrencyQuery currencyQuery,
CustomerQuery customerQuery,
CustomerGroupQuery customerGroupQuery,
ExpenseQuery expenseQuery,
TaxEventQuery taxEventQuery,
ValidationRuleQuery validationRuleQuery,
PriceConditionQuery priceConditionQuery,
VendorQuery vendorQuery,
TaxGroupQuery productClassQuery,
PurchaseOrderQuery purchaseOrderQuery,
GoodsReceiptQuery goodsReceiptQuery,
GoodsIssueQuery goodsIssueQuery,
SaleAttributeQuery saleAttributeQuery,
StockTransferQuery stockTransferQuery,
StateQuery stateQuery,
LineAttributeQuery lineAttributeQuery,
LoyaltySetupQuery loyaltySetupQuery,
LayawayPlanQuery layawayPlanQuery,
InventoryCycleSetupQuery inventoryCycleSetupQuery,
StockTransferRequestQuery stockTransferRequestQuery,
SecurityUserQuery securityUserQuery,
ProductCategoryQuery productCategoryQuery,
LoyaltyLevelQuery loyaltyLevelQuery,
PaymentTypeQuery paymentTypeQuery,
TaxJurisdictionQuery taxJurisdictionQuery,
TaxAreaQuery taxAreaQuery,
TaxConditionQuery taxConditionQuery,
TillMasterQuery tillMasterQuery,
TillQuery tillQuery,
RegisteredApplicationQuery registeredApplicationQuery,
GiftCertificateQuery giftCertificateQuery,
GiftCertificateManagementQuery giftCertificateManagementQuery,
MerchandiseHierarchyDetailQuery merchandiseHierarchyDetailQuery,
CouponQuery couponQuery,
RetailTransactionQuery retailTransactionQuery,
SalesTargetQuery salesTargetQuery,
PrintFormatQuery printFormatQuery,
InventoryReportQuery inventoryReportQuery,
SecurityRoleQuery securityRoleQuery,
TenderCollectionReportQuery tenderCollectionReportQuery,
InventoryMovementReportQuery inventoryMovementReportQuery,
TaxCollectionReportQuery taxCollectionReportQuery,
TaxPayableReportQuery taxPayableReportQuery,
SalesTargetReportQuery salesTargetReportQuery,
TaxCodeQuery taxCodeQuery,
SalesReportQuery salesReportQuery,
CustomerReportQuery customerReportQuery
)
{
AddField(roleQuery.GetFieldType());
AddField(organizationUnitQuery.GetFieldType());
AddField(userQuery.GetFieldType());
AddField(auditLogQuery.GetFieldType());
AddField(productQuery.GetFieldType());
AddField(teamQuery.GetFieldType());
AddField(vendorGroupQuery.GetFieldType());
AddField(retailProfileQuery.GetFieldType());
AddField(fulfillmentQuery.GetFieldType());
AddField(surchargeQuery.GetFieldType());
AddField(warehouseQuery.GetFieldType());
AddField(manufacturerQuery.GetFieldType());
AddField(countryQuery.GetFieldType());
AddField(bankQuery.GetFieldType());
AddField(departmentQuery.GetFieldType());
AddField(jobCodeQuery.GetFieldType());
AddField(reasonCodeQuery.GetFieldType());
AddField(barCodeMaskQuery.GetFieldType());
AddField(shippingTypeQuery.GetFieldType());
AddField(productGroupQuery.GetFieldType());
AddField(retailEventQuery.GetFieldType());
AddField(retailMessageQuery.GetFieldType());
AddField(cashRegisterQuery.GetFieldType());
AddField(currencyQuery.GetFieldType());
AddField(customerQuery.GetFieldType());
AddField(customerGroupQuery.GetFieldType());
AddField(expenseQuery.GetFieldType());
AddField(taxEventQuery.GetFieldType());
AddField(validationRuleQuery.GetFieldType());
AddField(priceConditionQuery.GetFieldType());
AddField(productClassQuery.GetFieldType());
AddField(vendorQuery.GetFieldType());
AddField(purchaseOrderQuery.GetFieldType());
AddField(saleAttributeQuery.GetFieldType());
AddField(lineAttributeQuery.GetFieldType());
AddField(inventoryCycleSetupQuery.GetFieldType());
AddField(goodsReceiptQuery.GetFieldType());
AddField(stockTransferQuery.GetFieldType());
AddField(stateQuery.GetFieldType());
AddField(goodsIssueQuery.GetFieldType());
AddField(loyaltySetupQuery.GetFieldType());
AddField(layawayPlanQuery.GetFieldType());
AddField(stockTransferRequestQuery.GetFieldType());
AddField(securityUserQuery.GetFieldType());
AddField(productCategoryQuery.GetFieldType());
AddField(loyaltyLevelQuery.GetFieldType());
AddField(paymentTypeQuery.GetFieldType());
AddField(taxJurisdictionQuery.GetFieldType());
AddField(taxAreaQuery.GetFieldType());
AddField(taxConditionQuery.GetFieldType());
AddField(tillMasterQuery.GetFieldType());
AddField(tillQuery.GetFieldType());
AddField(registeredApplicationQuery.GetFieldType());
AddField(giftCertificateQuery.GetFieldType());
AddField(giftCertificateManagementQuery.GetFieldType());
AddField(merchandiseHierarchyDetailQuery.GetFieldType());
AddField(couponQuery.GetFieldType());
AddField(retailTransactionQuery.GetFieldType());
AddField(salesTargetQuery.GetFieldType());
AddField(printFormatQuery.GetFieldType());
AddField(inventoryReportQuery.GetFieldType());
AddField(securityRoleQuery.GetFieldType());
AddField(tenderCollectionReportQuery.GetFieldType());
AddField(inventoryMovementReportQuery.GetFieldType());
AddField(taxCollectionReportQuery.GetFieldType());
AddField(taxPayableReportQuery.GetFieldType());
AddField(salesTargetReportQuery.GetFieldType());
AddField(taxCodeQuery.GetFieldType());
AddField(salesReportQuery.GetFieldType());
AddField(customerReportQuery.GetFieldType());
}
}
}
Hi Team,
I would like to take this opportunity to explain the business case again.
We have created a custom entity "Business Partner" via asp.net zero power tool and attached one or more abpuser(s) to this business partner.
Our requirement is if we delete this "Business partner" record from the WebGUI then behind the sceen through service API we would like to delete all attached abp user(s) assigned to this business partner including the one with which user is currently logged in.
So once all abp user(s) are deleted, we have to logout the current user and need to return to login page.
Now please let us know what code we need to write to delete, logout current user and list of user(s) we have and then will return to login page.
This current user needs to deleted behind the sceen through service api, not on controller apis or direct through Angular Api.
We are open to have webex session with you. Please let us know the email id where invite can be send.
Hi,
I have disabled this plugin, still i am not able to generate the entities. FYI, till last version everytnig was working fine. Only in latest version (2.6.1), this issue started coming. Please see below screenshot of disabled toolkit and latest logs:
DEBUG 2020-09-10 13:58:17,974 [168 ] it.Telemetry.Internal.TelemetryPublisher - Telemetry Publisher loop has stopped. INFO 2020-09-10 13:58:17,977 [1 ] it.MobileAnalytics.SimpleMobileAnalytics - Queuing analytics event in local queue with timestamp: 09/10/2020 08:28:17 INFO 2020-09-10 13:58:17,981 [1 ] it.MobileAnalytics.SimpleMobileAnalytics - Main session was stopped. Attempting to force final analytics service call attempt. Note: Permission to collect analytics will be checked. INFO 2020-09-10 13:58:20,485 [63 ] it.MobileAnalytics.AMAServiceCallHandler - Reponse from AMAClient.PutEvents(request) meta data: Amazon.Runtime.ResponseMetadata, response HttpStatusCode: Amazon.Runtime.ResponseMetadata DEBUG 2020-09-10 14:02:45,366 [1 ] lVisualStudioExtension.AspNetZeroRadTool - Menu item clicked with params > loadFromJson: False, loadFromDatabase: False, showAboutForm: False DEBUG 2020-09-10 14:03:15,111 [1 ] dioExtension.Dialogs.EntityGeneratorForm - Generate entity started. DEBUG 2020-09-10 14:03:17,612 [1 ] dioExtension.Dialogs.EntityGeneratorForm - Entity successfully generated.
Hi Team,
We have created a custom entity "Business Partner" via asp.net zero power tool and attached one or more abp user(s) to this business partner.
My requirement is if web user delete this "Business partner" record from the webGUI then behind the sceen through service API we would like to delete all abp user(s) assigned to this business partner including the one with which user is currently logged in.
So once all abp user(s) are deleted, we have to logout the current user and need to return to login page. Now please let us know in this requirement, what code we need to write to delete, logout current user and list of user(s) we have and then will return to login page.
Hi @Team,
I have not found any logs in window event viewer related to this app. Please see below logs of Power Tools:
Power tool logs:
DEBUG 2020-09-09 14:25:15,351 [1 ] lVisualStudioExtension.AspNetZeroRadTool - Menu item clicked with params > loadFromJson: False, loadFromDatabase: False, showAboutForm: False DEBUG 2020-09-09 14:26:10,457 [1 ] dioExtension.Dialogs.EntityGeneratorForm - Generate entity started. DEBUG 2020-09-09 14:26:20,007 [1 ] dioExtension.Dialogs.EntityGeneratorForm - Entity successfully generated. DEBUG 2020-09-09 14:26:33,084 [1 ] lVisualStudioExtension.AspNetZeroRadTool - Menu item clicked with params > loadFromJson: False, loadFromDatabase: False, showAboutForm: True ERROR 2020-09-09 14:26:55,348 [1 ] isualStudio.Lambda.LambdaTesterUtilities - Error configuring Lambda Tester on project. FileName: , FullName: , UniqueName: <MiscFiles> System.Exception: Unable to determine project FileName at Amazon.AWSToolkit.VisualStudio.Lambda.LambdaTesterUtilities.EnsureLambdaTesterConfigured(Project project, IAWSLambda lambdaPlugin) DEBUG 2020-09-09 14:31:14,993 [83 ] it.Telemetry.Internal.TelemetryPublisher - Telemetry Publisher loop has stopped. INFO 2020-09-09 14:31:14,997 [1 ] it.MobileAnalytics.SimpleMobileAnalytics - Queuing analytics event in local queue with timestamp: 09/09/2020 09:01:14 INFO 2020-09-09 14:31:15,014 [1 ] it.MobileAnalytics.SimpleMobileAnalytics - Main session was stopped. Attempting to force final analytics service call attempt. Note: Permission to collect analytics will be checked. INFO 2020-09-09 14:31:17,595 [156 ] it.MobileAnalytics.AMAServiceCallHandler - Reponse from AMAClient.PutEvents(request) meta data: Amazon.Runtime.ResponseMetadata, response HttpStatusCode: Amazon.Runtime.ResponseMetadata DEBUG 2020-09-09 14:33:14,526 [1 ] lVisualStudioExtension.AspNetZeroRadTool - Menu item clicked with params > loadFromJson: False, loadFromDatabase: False, showAboutForm: True INFO 2020-09-09 14:34:01,195 [1 ] it.MobileAnalytics.SimpleMobileAnalytics - Queuing analytics event in local queue with timestamp: 09/09/2020 09:04:01 DEBUG 2020-09-09 14:34:01,202 [8 ] it.Telemetry.Internal.TelemetryPublisher - Telemetry Publisher loop has stopped. INFO 2020-09-09 14:34:01,218 [1 ] it.MobileAnalytics.SimpleMobileAnalytics - Main session was stopped. Attempting to force final analytics service call attempt. Note: Permission to collect analytics will be checked. INFO 2020-09-09 14:34:03,765 [112 ] it.MobileAnalytics.AMAServiceCallHandler - Reponse from AMAClient.PutEvents(request) meta data: Amazon.Runtime.ResponseMetadata, response HttpStatusCode: Amazon.Runtime.ResponseMetadata DEBUG 2020-09-09 14:35:23,793 [1 ] lVisualStudioExtension.AspNetZeroRadTool - Menu item clicked with params > loadFromJson: False, loadFromDatabase: False, showAboutForm: False DEBUG 2020-09-09 14:36:14,641 [1 ] dioExtension.Dialogs.EntityGeneratorForm - Generate entity started. DEBUG 2020-09-09 14:36:16,893 [1 ] dioExtension.Dialogs.EntityGeneratorForm - Entity successfully generated.
Hi Team,
Could you please give me sample code how will write this logic in our service API project (in OneEnterprise.iHUB.Application project). I am not still not getting why do mean by keyword "endpoint " here.