Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor Client support #99

Open
rfcdejong opened this issue Dec 4, 2020 · 0 comments
Open

Blazor Client support #99

rfcdejong opened this issue Dec 4, 2020 · 0 comments

Comments

@rfcdejong
Copy link

We are trying to re-use our C# business layer in Blazor, our business layer is more a 'smart object' CSLA structure and we tied it to log4net. It requires the frontend to have it configured and the backend to have it configured. One solution is to remove log4net where ever possible and then use default logproviders or else Serilog.

I'm however looking at solutions that require less work, perhaps using this package. It works for .NET Core and blazor server side only. It would require us to implement a facade from Blazor Client to Blazor Server and then from Blazor Server we can use our existing business layer which communicates to another server again.. I rather use our business layer inside Blazor Client for calling the server.

However i get exceptions like

System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.PlatformNotSupportedException: Operation is not supported on this platform

I notice that this package doesn't use the Configuration, but configures to load a xml in the startup.
So I tried it...

loggerFactory.AddLog4Net("log4Net.xml");

Is it intended to work in Blazor Client? Could it work? This doesn't work, but maybe if there is something modified or in a new version?

    public static async Task Main(string[] args)
    {
        var builder = WebAssemblyHostBuilder.CreateDefault(args);
        builder.RootComponents.Add<App>("app");
        builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

        ...

        builder.Logging.AddLog4Net("log4Net.xml");

        await builder.Build().RunAsync();
    }

throws error:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant