Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "dauren"

Nevermind this question, it was my bad, I figured it out.

- 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.

Thanks, once I enabled SSL it works.

I have migrated the database using Migrator.exe, seems like everything went ok. But, now I cannot enter the application using default credentials. It just redirects me back to login page. What could be the problem?

I tried copying the LinkEd.Migrator.deps.json file and running the Migrator.exe, and it gave error saying that LinkEd.Migrator.runtimeconfig.json was not found, all of these files exist in publish folder and the Migrator.exe runs perfectly ok in publish folder. But I can not update the connection string in appsettings.json of Migrator project during publish, so I can not use Migrator.exe there. Variable substitution changes connection string for appsettings.json in wwwroot folder only. If I manually edit the connection string in appsettings.json of Migrator project in publish folder, migration works perfectly. However, I suppose this is not question of aspnet zero. Thanks for help.

Okay, so I figured out how to migrate all databases by default, by uncommenting the code which is in Migrator project. But I have another issue now. Whenever I try to run Migrator.exe in deployed folder inetpub/wwwroot it asks for LinkEd.Migrator.deps.json file

OKay, I have figured out how to properly execute the Migrator.exe in pipeline. By default, it looks for the log4net.file in different directory, for some reason. I had to specify the Working directory option for my Batch script step, where you have to specify the directory where the Migrator.exe is located. Working directory option is under Advanced section.

But now the result is:

2021-01-13T17:46:27.7228038Z 2021-01-13 20:46:27 | Continue to migration for this host database and all tenants..? (Y/N): 2021-01-13T17:46:27.7229064Z 2021-01-13 20:46:27 | Migration canceled.

How can I specify that it should migrate all databases (tenant and host) by default?

Hi, thank you for reply. I have followed your advice and successfully published the migrator project. When I try to run it i receive the following error:

2021-01-13T17:15:58.4173562Z Unhandled exception. System.IO.FileNotFoundException: Could not find file 'C:\azagent\A1\_work\r2\a\log4net.config'. 2021-01-13T17:15:58.4174850Z File name: 'C:\azagent\A1\_work\r2\a\log4net.config' 2021-01-13T17:15:58.4175321Z at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle) 2021-01-13T17:15:58.4175783Z at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options) 2021-01-13T17:15:58.4176369Z at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) 2021-01-13T17:15:58.4176938Z at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) 2021-01-13T17:15:58.4177277Z at System.IO.File.OpenRead(String path) 2021-01-13T17:15:58.4177759Z at Abp.Castle.Logging.Log4Net.Log4NetLoggerFactory..ctor(String configFileName) 2021-01-13T17:15:58.4178073Z at lambda_method1(Closure , Object[] ) 2021-01-13T17:15:58.4178491Z at Castle.Core.Internal.ReflectionUtil.Instantiate(ConstructorInfo ctor, Object[] ctorArgs) 2021-01-13T17:15:58.4178996Z at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) 2021-01-13T17:15:58.4179522Z at Castle.Core.Internal.ReflectionUtil.CreateInstance[TBase](Type subtypeofTBase, Object[] ctorArgs) 2021-01-13T17:15:58.4180031Z at Castle.Facilities.Logging.LoggingFacility.CreateProperLoggerFactory(LoggerImplementation loggerApi) 2021-01-13T17:15:58.4180534Z at Castle.Facilities.Logging.LoggingFacility.ReadConfigurationAndCreateLoggerFactory() 2021-01-13T17:15:58.4180971Z at Castle.Facilities.Logging.LoggingFacility.Init() 2021-01-13T17:15:58.4181456Z at Castle.MicroKernel.Facilities.AbstractFacility.Castle.MicroKernel.IFacility.Init(IKernel kernel, IConfiguration facilityConfig) 2021-01-13T17:15:58.4181957Z at Castle.MicroKernel.DefaultKernel.AddFacility(IFacility facility) 2021-01-13T17:15:58.4182388Z at Castle.MicroKernel.DefaultKernel.AddFacility[T](Action1 onCreate) 2021-01-13T17:15:58.4182799Z at Castle.Windsor.WindsorContainer.AddFacility[T](Action1 onCreate) 2021-01-13T17:15:58.4183307Z at LinkEd.Migrator.Program.Main(String[] args) in D:\a\1\s\src\LinkEd.Migrator\Program.cs:line 22

But I see that the log4net.config file is present at the running directory of migrator.exe

- 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?

Showing 1 to 9 of 9 entries