Apologies for the wounded question, it is my first time here. I created a microservices application using abp.io. There is a sign up page and when the details are supplied an account is created. However, when logging in, tenant switch finds the tenant but logiing throws error:
An exception was thrown while activating Pages.Abp.MultiTenancy.AbpTenantController.
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Pages.Abp.MultiTenancy.AbpTenantController.
---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Pages.Abp.MultiTenancy.AbpTenantController' can be invoked with the available services and parameters:
Cannot resolve parameter 'Volo.Abp.AspNetCore.Mvc.MultiTenancy.IAbpTenantAppService abpTenantAppService' of constructor 'Void .ctor(Volo.Abp.AspNetCore.Mvc.MultiTenancy.IAbpTenantAppService)'.
What package am i missing? Apologies
I checked the api routing in the gateway. Api route for tenants is set to
"saas": {
"ClusterId": "saas",
"Match": {
"Path": "/api/multi-tenancy/{*any}"
}
Additonal information:
when I test the api from swagger, the following endpoints throw the same error:
https://localhost:49555/api/abp/multi-tenancy/tenants/by-id/
https://localhost:7003/api/abp/multi-tenancy/tenants/by-name/
500 error code
Error message:
{
"error": {
"code": null,
"message": "An internal error occurred during your request!",
"details": null,
"data": {
"ActivatorChain": "Pages.Abp.MultiTenancy.AbpTenantController"
},
"validationErrors": null
}
}
This is resolved, I was missing the following in my Saas module:
DependsOn[typeof(AbpAspNetCoreMvcUiMultiTenancyModule)]
I had the package installed.
Related
I get an error when creating EF migrations in my C# ASP.NET MVC project:
An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Specified argument was out of the range of valid values. (Parameter 'timeout')
I have installed the mentioned package (it wasn't installed originally) to the version in line with the other packages across the projects, which was 6.01, I have updated it to 7.0 and have updated the others. Has anyone else experienced this? I can't see anything else related to timeout online.
Edit:
This is a sample of the logs around the migration in the PMC
Finding Microsoft.Extensions.Hosting service provider...
Using environment 'Development'.
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'timeout')
at System.Threading.Tasks.Task.Wait(TimeSpan timeout)
at Microsoft.Extensions.Hosting.HostFactoryResolver.HostingListener.CreateHost()
at Microsoft.Extensions.Hosting.HostFactoryResolver.<>c__DisplayClass10_0.b__0(String[] args)
at Microsoft.Extensions.Hosting.HostFactoryResolver.<>c__DisplayClass13_0.b__3(String[] args)
at Microsoft.EntityFrameworkCore.Design.Internal.AppServiceProviderFactory.CreateFromHosting(String[] args)
An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Specified argument was out of the range of valid values. (Parameter 'timeout')
No application service provider was found.
This is a copy of my appSettings.json file:
{
"Version": "",
"Vault": "",
"ClientId": "",
"ClientSecret": "",
"CorsAllowedOrigins": "",
"Logging": {
"LogLevel": {
"Default": "Warning",
"System": "Warning",
"Microsoft": "Warning"
}
},
"ConnectionStrings": {
"CommonDbContext": "Server=(localdb)\\mssqllocaldb;Database=database1;Trusted_Connection=True;MultipleActiveResultSets=true",
"ApplicationDbContext": "Server=(localdb)\\mssqllocaldb;Database=database2;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"API": "https://localhost:44383",
"API": "https://localhost:44325",
"API": "https://localhost:44317",
"API": "https://localhost:44312",
"API": "https://localhost:44311"
}
I am very new to Graphql and trying to implement mutations in dotnet using nreco.graphql, as of now there are no errors in the project files , when I tried to execute the mutation query am getting below error message. It says the input format what we are passing is not valid but I verified it many times and there is no error in it. So please help me to resolve the issue.
Query:
mutation($TestValue:TestInput!) {
ActivateInactivateUser(data:$TestValue) {
Status
}
}
Query Variables:
{
"TestValue": {
"UserID": "5",
"UserName": "Test",
"Status": "Inactive"
}
}
Error message:
Variable '$TestValue' is invalid. Unable to parse input as a 'TestInput' type. Did you provide a List or Scalar value accidentally
I am very new to Graphql and trying to implement mutations in dotnet using nreco.graphql, as of now there are no errors in the project file
As far as I know, NReco.GraphQL based on engine Graph.Net. When it comes to mutation queries - you can check the docs from Graph.Net team here
Error message: Variable '$TestValue' is invalid. Unable to parse input as a 'TestInput' type. Did you provide a List or Scalar value accidentally
Did you set up an appropriate model for the method "ActivateInactivateUser"?
You ought to add sth like this:
public class TestInputType : InputObjectGraphType
I'm working on adding propagation to HotChocolate GraphQL server but simply can't get it working.
I've configured my propagation in my ConfigureServices services.AddHeaderPropagation(o => o.Headers.Add("Authorization"));
I've added it to my httpClient: services.AddHttpClient(AssumptionManagement, c => c.BaseAddress = new Uri("http://localhost:19801")).AddHeaderPropagation();
I've added it in my Configure method:
app.UseHeaderPropagation();
Despite all this it still gives me the following error when I run the app in debug:
An unhandled exception of type System.InvalidOperationException occurred in System.Private.CoreLib.dll: The HeaderPropagationValues.Headers property has not been initialized.
Register the header propagation middleware by adding app.UseHeaderPropagation() in the Configure(...) method. Header propagation can only be used within the context of an HTTP request.'
Am I just not seeing something here or what am I doing wrong?
In my IContainer I am trying to register my DBContext. And this approach works:
builder.Register(c =>
{
var opt = new DbContextOptionsBuilder<ProjectsDbContext>();
opt.UseSqlServer("Server=(localdb)\\MSSQLLocalDB;Database=Portfolio_Strona;Trusted_Connection=True;MultipleActiveResultSets=true");
return new ProjectsDbContext(opt.Options);
}).AsSelf().InstancePerLifetimeScope();
And now I wanted to replace connection string with this:
string connString= ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;
builder.Register(c =>
{
var opt = new DbContextOptionsBuilder<ProjectsDbContext>();
opt.UseSqlServer(connString);
return new ProjectsDbContext(opt.Options);
}).AsSelf().InstancePerLifetimeScope();
And I am getting exception:
Autofac.Core.DependencyResolutionException: 'An exception was thrown
while activating
CV_Creator.Desktop.ViewModels.ProjectLoaderViewModel.'
2 inner exceptions:
DependencyResolutionException: An exception was thrown while invoking
the constructor 'Void .ctor(CV_Creator.DAL.IProjectRepository,
CV_Creator.Services.IProjectCollectionDisplayService,
CV_Creator.Services.IWindowManager)' on type 'ProjectLoaderViewModel'.
and
SqlException: A network-related or instance-specific error occurred
while establishing a connection to SQL Server. The server was not
found or was not accessible. Verify that the instance name is correct
and that SQL Server is configured to allow remote connections.
(provider: SQL Network Interfaces, error: 50 - Local Database Runtime
error occurred. Specified LocalDB instance name is invalid. )
How can I register or resolve ConfigurationManager, that Autofac can see it?
Things I already tryed:
This
System.Configuration.ConfigurationBuilder does not contain definition
for SetBasePath
Microsoft.Extensions.Configuration.ConfigurationBuilder does not
contain definition for SetBasePath
This
Autofac.Core.DependencyResolutionException: 'An exception was thrown
while activating CV_Creator.Desktop.ViewModels.ProjectLoaderViewModel
-> CV_Creator.DAL.ProjectRepository -> λ:CV_Creator.DAL.ProjectsDbContext.' Inner exception:
ComponentNotRegisteredException: The requested service
'Microsoft.Extensions.Configuration.IConfiguration' has not been
registered. To avoid this exception, either register a component to
provide the service, check for service registration using
IsRegistered(), or use the ResolveOptional() method to resolve an
optional dependency.
Is there any way to resolve ConfigurationManager with Autofac IoC container?
UPDATED
New approach tried, in IoC Container:
builder.RegisterType<ProjectsDbContext>().InstancePerLifetimeScope();
and in DbContext:
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(ConfigurationManager.AppSettings["connectionString"]);
}
I receive exception:
Autofac.Core.DependencyResolutionException: 'An exception was thrown
while activating CV_Creator.Desktop.ViewModels.ProjectLoaderViewModel
-> CV_Creator.DAL.ProjectRepository -> CV_Creator.DAL.ProjectsDbContext.' DependencyResolutionException: None
of the constructors found with
'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type
'CV_Creator.DAL.ProjectsDbContext' can be invoked with the available
services and parameters: Cannot resolve parameter
'Microsoft.EntityFrameworkCore.DbContextOptions1[CV_Creator.DAL.ProjectsDbContext] options' of constructor 'Void .ctor(Microsoft.EntityFrameworkCore.DbContextOptions1[CV_Creator.DAL.ProjectsDbContext])'.
Let's say my function is the following:
public static void Run([QueueTrigger(queueName, Connection = connection)]string message,
TraceWriter logger) {
throw new CustomException();
}
Here's what the log looks like:
SomeTime [Error] ExceptionNameSpace.CustomException ---> System.Exception
When I go to App Insights and view the exception breakdown, I find this failed request under the "Exception" type. I don't even see a CustomException type listed! Why is my exception being transformed into a generic exception?
For those of you who ran into the same issue:
I found the "solution" for this by being able to recover my original exception by querying for the outerType column in the exceptions table inside the Analytics part of App Insights. Strange that the generic exception shows up under the "type" column but "outerType" is my original exception.