As stated in the docs you can Configure --app-max-concurrency for the orders service
# Configure --app-max-concurrency for the orders service
extensions:
- name: dapr
services:
orders:
app-max-concurrency: 1
services:
- name: orders
project: orders/orders.csproj
- name: products
project: products/products.csproj
- name: store
project: store/store.csproj
but when I try on my tye.yaml file I get the following error message:
Error parsing tye.yaml: (23, 7): Expected scalar value for key: "services".
Related
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.
I've followed this article to use autorest to generate API client library:
How to Automatically Generate Clients for your REST API
I executed this command in VS2019 first:
iwr http://localhost:5000/swagger/v1/swagger.json -o ./docs/openapi/api-v1.json
This works well. I can see the json file generated successfully. I then executed this autorest command:
autorest --input-file=./docs/openapi/api-v1.json --v3 --csharp --use-datetimeoffset=true --sync-methods=none --output-folder=./src/SampleApi.Client --namespace=SampleApi.Client
Bunch of errors occurred and they are all the same type:
node.exe : ERROR: Semantic violation: Path parameter 'SchoolKey' referenced in path '/Schools/Details/{SchoolKey}' needs to be defined in every operation at either
the path or operation level. (Missing in 'post') (paths > /Schools/Details/{SchoolKey})
I am not sure what this error means and how to fix it? This is my function:
[HttpPost]
[Authorize(Policy = Policies.User)]
[Route("{SchoolKey}")]
public async Task<ApiResponse> Details(string schoolKey)
{
...
}
And my controller is like this:
[ApiController]
[Route("[controller]/[action]")]
public class SchoolsController
The end point of the API is "/Schools/Details/12345"
So what do I need to change my function/controller to make autorest work?
Thanks!
I got the error when requesting the page in http://localhost:56191/WebImages/index:
*An unhandled exception occurred while processing the request.*<br>
*AmbiguousMatchException: The request matched multiple endpoints. Matches:*
*WebApp.Controllers.WebImagesController.Index (WebApp)*<br>
*WebApp.Views.WebImagesController.Index (WebApp)*
*Microsoft.AspNetCore.Routing.Matching.DefaultEndpointSelector.ReportAmbiguity(CandidateState[] candidateState)*
Could this be because I ran due to update in the DB ?:
"Scaffold-DbContext "Server=Machinexx; Database=MyDBxx; Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -force"
CodeCaster was right. I got another Controller with the same name inside the View folder, and I have no idea how it got there.
I need to deploy my azure function to AKS using new KEDA event-driven autoscaler. Function binds to service bus queue and waiting for some messages to come. When I apply function deployment script to K8s, new deployment and scaled object are created, but 0 pods are scheduled to perform action (there are some messages in the queue).
I created simple function just to illustrate the same behavior.
Deployment script
data:
AzureWebJobsStorage: <value>
FUNCTIONS_WORKER_RUNTIME: ZG90bmV0
ServiceBusConnection: <value>
apiVersion: v1
kind: Secret
metadata:
name: myqueuefunction
namespace: default
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: myqueuefunction
namespace: default
labels:
app: myqueuefunction
spec:
selector:
matchLabels:
app: myqueuefunction
template:
metadata:
labels:
app: myqueuefunction
spec:
containers:
- name: myqueuefunction
image: <container>
env:
- name: AzureFunctionsJobHost__functions__0
value: MyQueueFunction
envFrom:
- secretRef:
name: myqueuefunction
---
apiVersion: keda.k8s.io/v1alpha1
kind: ScaledObject
metadata:
name: myqueuefunction
namespace: default
labels:
deploymentName: myqueuefunction
spec:
scaleTargetRef:
deploymentName: myqueuefunction
triggers:
- type: azure-servicebus
metadata:
type: serviceBusTrigger
connection: ServiceBusConnection
queueName: importedqueue
name: myQueueItem
---
Function code:
[FunctionName("MyQueueFunction")]
public static void Run(
[ServiceBusTrigger("importedqueue", Connection = "ServiceBusConnection")]
Message myQueueItem,
ILogger log)
{
log.LogInformation($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
}
K8S
Overview
Deployment information
Replica information
Autoscaler information
Can any one suggest how to debug it at least? Or what am I doing wrong?
The best place to start debugging is looking at the logs of the KEDA pod. Something like kubectl logs -n keda keda-keda-<someGuid> which should tell you what it sees, if anything.
I ran into an issue before I need to try to repro where I needed to use a queue connection string directly rather than a namespace level connection string. Not sure if that resolves for you as well
https://github.com/kedacore/keda/issues/215
I have created new Azure Function for QueueTrigger but after running it locally getting some weird error below.
Function1.cs
public static class Function1
{
[FunctionName("Function1")]
public static void Run([QueueTrigger("demoqueue", Connection = "DefaultEndpointsProtocol=myconnectionstring")]string myQueueItem, TraceWriter log)
{
log.Info($"C# Queue trigger function processed: {myQueueItem}");
}
}
local.setting.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobsDashboard": "UseDevelopmentStorage=true"
}
}
Error -
[11/14/2018 4:36:15 PM] The following 1 functions are in error:
[11/14/2018 4:36:15 PM] Run: Microsoft.Azure.WebJobs.Host: Error
indexing method 'Function1.Run'. Microsoft.Azure.WebJobs.Host:
Microsoft Azure WebJobs SDK '[Hidden Credential]' connection string is
missing or empty. The Microsoft Azure Storage account connection
string can be set in the following ways: [11/14/2018 4:36:15 PM] 1.
Set the connection string named '[Hidden Credential]' in the
connectionStrings section of the .config file in the following format
, or [11/14/2018 4:36:15 PM] 2. Set the environment variable named
'[Hidden Credential]', or [11/14/2018 4:36:15 PM] 3. Set corresponding
property of JobHostConfiguration.
You need to specify the key of the app setting where your connection string is stored in the config not the connectionstring itself.
public static void Run([QueueTrigger("demoqueue", Connection = "NameOfYourAppSetting")]