Destination Unknown
Destination Unknown
CC#
Created by Destination Unknown on 4/24/2025 in #help
ASP.Net Core Web API unable to connect due to CORS
ARGH
11 replies
CC#
Created by Destination Unknown on 4/24/2025 in #help
ASP.Net Core Web API unable to connect due to CORS
Using Edge works
11 replies
CC#
Created by Destination Unknown on 4/24/2025 in #help
ASP.Net Core Web API unable to connect due to CORS
it was the fockin browser. I used Brave for this, but brave blocked it.
11 replies
CC#
Created by Destination Unknown on 4/24/2025 in #help
ASP.Net Core Web API unable to connect due to CORS
There is something else wrong. I do not get what it can be...
11 replies
CC#
Created by Destination Unknown on 4/24/2025 in #help
ASP.Net Core Web API unable to connect due to CORS
But do i actually need CORS? Because as far as I know, CORS is used when you want to perform HTTP-requests to another domain. In my case everything is local(host).
11 replies
CC#
Created by Destination Unknown on 4/24/2025 in #help
ASP.Net Core Web API unable to connect due to CORS
No description
11 replies
CC#
Created by Destination Unknown on 4/24/2025 in #help
ASP.Net Core Web API unable to connect due to CORS
Without the CORS stuff, you can remove the following lines of the program.cs;
c#
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAll", builder =>
{
builder
.WithOrigins("https://localhost:8080", "http://localhost:8081")
.AllowAnyHeader()
.AllowAnyMethod();
});
});

app.UseCors("AllowAll");
c#
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAll", builder =>
{
builder
.WithOrigins("https://localhost:8080", "http://localhost:8081")
.AllowAnyHeader()
.AllowAnyMethod();
});
});

app.UseCors("AllowAll");
11 replies
CC#
Created by Destination Unknown on 4/24/2025 in #help
ASP.Net Core Web API unable to connect due to CORS
appsettings.json: nothing really useful docker-compose.override:
services:
myProject.api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_HTTP_PORTS=8080
- ASPNETCORE_HTTPS_PORTS=8081
ports:
- "8080:8080"
- "8081:8081"
services:
myProject.api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_HTTP_PORTS=8080
- ASPNETCORE_HTTPS_PORTS=8081
ports:
- "8080:8080"
- "8081:8081"
docker-compose.yml
services:
myProject.api:
container_name: api
image: ${DOCKER_REGISTRY-}myProjectapi
build:
context: .
dockerfile: Sample.API/Dockerfile
ports:
- "8080:8080"
- "8081:8081"
services:
myProject.api:
container_name: api
image: ${DOCKER_REGISTRY-}myProjectapi
build:
context: .
dockerfile: Sample.API/Dockerfile
ports:
- "8080:8080"
- "8081:8081"
11 replies
CC#
Created by Destination Unknown on 4/24/2025 in #help
ASP.Net Core Web API unable to connect due to CORS
c#
using Asp.Versioning;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Identity.Web;
using System.Text.Json.Serialization;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd"));

builder.Services.AddControllers().AddJsonOptions(x =>
{
x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
});
builder.Services.AddProblemDetails();
builder.Services.AddApiVersioning(options =>
{
options.ReportApiVersions = true;
options.AssumeDefaultVersionWhenUnspecified = true;
options.DefaultApiVersion = new ApiVersion(1, 0);
options.ApiVersionReader = new UrlSegmentApiVersionReader();
}).AddApiExplorer(options =>
{
options.GroupNameFormat = "'v'VVV";
options.SubstituteApiVersionInUrl = true;
});

builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAll", builder =>
{
builder
.WithOrigins("https://localhost:8080", "http://localhost:8081")
.AllowAnyHeader()
.AllowAnyMethod();
});
});


// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}

if (app.Environment.IsStaging() || app.Environment.IsProduction())
{
app.UseHttpsRedirection();
}

app.UseCors("AllowAll");

app.UseAuthentication();

app.MapControllers();

#pragma warning disable S6966
app.Run();
#pragma warning restore S6966
c#
using Asp.Versioning;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Identity.Web;
using System.Text.Json.Serialization;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd"));

builder.Services.AddControllers().AddJsonOptions(x =>
{
x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
});
builder.Services.AddProblemDetails();
builder.Services.AddApiVersioning(options =>
{
options.ReportApiVersions = true;
options.AssumeDefaultVersionWhenUnspecified = true;
options.DefaultApiVersion = new ApiVersion(1, 0);
options.ApiVersionReader = new UrlSegmentApiVersionReader();
}).AddApiExplorer(options =>
{
options.GroupNameFormat = "'v'VVV";
options.SubstituteApiVersionInUrl = true;
});

builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAll", builder =>
{
builder
.WithOrigins("https://localhost:8080", "http://localhost:8081")
.AllowAnyHeader()
.AllowAnyMethod();
});
});


// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}

if (app.Environment.IsStaging() || app.Environment.IsProduction())
{
app.UseHttpsRedirection();
}

app.UseCors("AllowAll");

app.UseAuthentication();

app.MapControllers();

#pragma warning disable S6966
app.Run();
#pragma warning restore S6966
11 replies
CC#
Created by Destination Unknown on 4/4/2025 in #help
Adding Python project to Solution in combination with Docker error
To get back to the question; why do I need to add an .exe file myself? to get it running with Docker
24 replies
CC#
Created by Destination Unknown on 4/4/2025 in #help
Adding Python project to Solution in combination with Docker error
No description
24 replies
CC#
Created by Destination Unknown on 4/4/2025 in #help
Adding Python project to Solution in combination with Docker error
Exactly
24 replies
CC#
Created by Destination Unknown on 4/4/2025 in #help
Adding Python project to Solution in combination with Docker error
Adding my own exe file works. But why?
24 replies
CC#
Created by Destination Unknown on 1/16/2025 in #help
Visual Studio integration with Docker Compose not functioning as expected.
23 replies
CC#
Created by Destination Unknown on 1/16/2025 in #help
Visual Studio integration with Docker Compose not functioning as expected.
Gonna do that now 🙂
23 replies
CC#
Created by Destination Unknown on 1/16/2025 in #help
Visual Studio integration with Docker Compose not functioning as expected.
Shall I make for this an official issue?
23 replies
CC#
Created by Destination Unknown on 1/16/2025 in #help
Visual Studio integration with Docker Compose not functioning as expected.
This error showed up due to my LaunchSettings.json in the docker-compose orchestration not being updated.
23 replies
CC#
Created by Destination Unknown on 1/16/2025 in #help
Visual Studio integration with Docker Compose not functioning as expected.
I just see that my initial message was pointed towards another issue I was facing, but I am sure I can fix that one. Regarding the Could not copy the file "C:\Projects\nhs-frontend-csharp\nhs-frontend-csharp.advice\bin\Microsoft.PythonTools.WebRole.dll" because it was not found.; yes that one is solved. I only find it weird that this issue occurs, because it means that adding a Flask Web Project is not build ready. Adding the bin folder with that file works however, should this file not be there already by default....?
23 replies
CC#
Created by Destination Unknown on 1/16/2025 in #help
Visual Studio integration with Docker Compose not functioning as expected.
Literally created a bin folder and added the file from above.
23 replies
CC#
Created by Destination Unknown on 1/16/2025 in #help
Visual Studio integration with Docker Compose not functioning as expected.
I Fixed it! but its quirte lame
23 replies