Westwind.Globalization
Where to find or catch error messages
Gravatar is a globally recognized avatar based on your email address. Where to find or catch error messages
  mlsomers
  All
  Jul 14, 2020 @ 07:25am

I heve installed the NuGet package Westwind.Globalization.AspnetCore31, applied the changes to Startup.cs, appsettings.json and added the zipfile resources to my project.

When I fire up the project in my browser (http://localhost:1123/LocalizationAdmin/index.html) I can see the nice GUI. When I click Create Table, I just see a small yellow notification stating that an unhandled error occurred. Looking under the hood I find this reply from the server: {"message":"An unhandled error occurred.","isError":true,"detail":null,"errors":null}

The database user has permission to create tables (or even create a new database).

I can't find any place to put a breakpoint on the server. Nothing is logged to System.Diagnostics.Trace or Debug and the eventlog is also empty.

Is there any way I can view the error details?

Gravatar is a globally recognized avatar based on your email address. re: Where to find or catch error messages
  mlsomers
  mlsomers
  Jul 14, 2020 @ 07:52am

Never mind, found the source of confusion. I had added the correct connectionstring to DbResourceConfiguration.json as well as in appsettings.json.

But I had blindly copied this to my startup.cs:

        ```csharp

services.AddWestwindGlobalization(opt => { // the default settings comme from DbResourceConfiguration.json if exists // you can override the settings here, the config you create is added // to the DI system (DbResourceConfiguration)

            // Resource Mode - from Database (or Resx for serving from Resources)
            opt.ResourceAccessMode = ResourceAccessMode.DbResourceManager;  // .Resx

            // Make sure the database you connect to exists
            opt.ConnectionString = "example that overwites any config";

            // Database provider used - Sql Server is the default
            opt.DataProvider = DbResourceProviderTypes.SqlServer;

            // The table in which resources are stored
            opt.ResourceTableName = "localizations";

            opt.AddMissingResources = false;
            opt.ResxBaseFolder = "~/Properties/";

            // Set up security for Localization Administration form
            opt.ConfigureAuthorizeLocalizationAdministration(actionContext =>
            {
                // return true or false whether this request is authorized
                return true;   //actionContext.HttpContext.User.Identity.IsAuthenticated;
            });

        });
Obviously it overrides all configuration!
Gravatar is a globally recognized avatar based on your email address. re: Where to find or catch error messages
  Rick Strahl
  mlsomers
  Jul 14, 2020 @ 01:54pm

It overrides the values you update. The configuration is first read from the config file (or other source) then passed into the configuration function...

You should be standard ASP.NET Core logging errors for errors that occur on the server if you're running in Kestrel, or you have logging enabled in your application. The globalization lib doesn't do any explicit logging but most errors are likely to be database errors that will be triggered by the built-in log support in the framework.

+++ Rick ---

© 1996-2020