- product version: 10.0 - product type: ASP.NET Core & jQuery - framework type .net core - ABP v6
Access to XMLHttpRequest at https://*******/api/services/app/RequestsPub/CreateNewRequest from origin https://example.com has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
I have CORS enabled in Web.Hosts project, in Startup.cs:
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();
});
});
and:
app.UseCors(DefaultCorsPolicyName); //Enable CORS!
also, as pointed in asp.net zero docs, in appsettings.json file of Web.Hosts project I added the domain:
"App": {
"ServerRootAddress": "
https://localhost:44301/
",
"ClientRootAddress": "
http://localhost:4200/
",
"CorsOrigins": "http://*.mycompany.com,http://localhost:4200,http://localhost:9876,https://example.com"
"SwaggerEndPoint": "/swagger/v1/swagger.json",
"AllowAnonymousSignalRConnection": "true"
},
When I use CreateNewRequest API endpoint in Postman it works ok. But when I use the endpoint from https://example.com domain it gives me error.
What could be the problem.
- product version: 10.0 - product type: ASP.NET Core & jQuery - framework type .net core - ABP v6
I added a reference to Migrator project in Web.Mvc project. So, I have the migrator.exe and other files in Web.Mvc project folder of artifacts. But I can not run it.
I am having trouble running migrator.exe on my local machine and on release pipeline in azure devops. I am using a Batch script tool in azure devops, where I selected migrator.exe in artifacts. I get the following error:
2021-01-12T08:12:33.9966523Z ##[command]C:\azagent\A1\_work\r2\a\_LinkEd-Classic-CI\drop\LinkEd.Web.Mvc\LinkEd.Migrator.exe
2021-01-12T08:12:34.0575972Z Cannot use file stream for [C:\azagent\A1\_work\r2\a\_LinkEd-Classic-CI\drop\LinkEd.Web.Mvc\LinkEd.Migrator.deps.json]: No such file or directory
2021-01-12T08:12:34.0578566Z A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet'.
2021-01-12T08:12:34.0579328Z Failed to run as a self-contained app.
2021-01-12T08:12:34.0580764Z - The application was run as a self-contained app because 'C:\azagent\A1\_work\r2\a\_LinkEd-Classic-CI\drop\LinkEd.Web.Mvc\LinkEd.Migrator.runtimeconfig.json' was not found.
2021-01-12T08:12:34.0581957Z - If this should be a framework-dependent app, add the 'C:\azagent\A1\_work\r2\a\_LinkEd-Classic-CI\drop\LinkEd.Web.Mvc\LinkEd.Migrator.runtimeconfig.json' file and specify the appropriate framework.
2021-01-12T08:12:34.2008684Z ##[error]Process completed with exit code -2147450749.
How do I get to generate <b>LinkEd.Migrator.deps.json</b> file?