I am creating pub sub for ASP.NET Core API and multiple ASP.NET Core MVC Clients.
So I would have some API Calculation who would send changed data to API Pub/Sub Service and him to send to subscribed MVC Clients.
My problem is that in mine MVC Client app in launchSettings.json
there is set port
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:50187",
"sslPort": 44366
}
Currently this is the why I am connecting to my MVC Client from ASP Pub/Sub service
HttpClient client = new HttpClient();
string baseUrl = Configuration.GetValue<string>("AppSettings:BaseUrl");
client.BaseAddress = new Uri(baseUrl);
var contentType = new MediaTypeWithQualityHeaderValue("application/json");
client.DefaultRequestHeaders.Accept.Add(contentType);
HttpResponseMessage response = await client.GetAsync(employeesApiUrl + "/Create?model=" + "Ok");
So this is my first time programing in ASP.NET Core and I wonder is my approach good and how can I make dynamic port so every new client have its own unique port?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…