[OBSOLETE] Error when specifing a value for logging.file in appsettings.json

I’m submitting a…

[ ] Regression (a behavior that topped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Documentation issue or request

Current behavior

I currently have a working instance of the application up and running on my local IIS-Server. However, when I in the appsettings-file try to specify a value for logging.file, the application returns a 500 at first http request (An error occurred while starting the application.). The logging though actually seems to work and I get a log file at the specified location, but as stated, the rest of the application does not want to start. I have pasted the error printed in the log file at the end.

The logging section of my appsettings.json is the following:

"logging": {
    "human": true,
    "colors": true,
	"file": "C:\\Temp\\Squidex.log"
} 

Perhaps I’m using the application wrong since the logging.file property isn’t in the original appsettings.json. If so, feel free to remove this bug report and if possible describe the proper way of specifying the log output.

Minimal reproduction of the problem

  • Assign any value to logging.file in the appsettings.json file.

Environment

  • [ ] Self hosted with version docker
  • [x] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Browser:

  • [x] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

Others:
Errorlog:

{
  "logLevel": "Fatal",
  "message": "Application startup exception",
  "eventId": {
    "id": 6
  },
  "exception": {
    "type": "System.InvalidCastException",
    "message": "Object cannot be stored in an array of this type.",
    "stackTrace": " 
   at System.Array.InternalSetValue(Void* target, Object value)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Squidex.Config.Domain.SystemExtensions.RunInitialization(IServiceProvider services) in C:\\GIT\\squidex\\src\\Squidex\\Config\\Domain\\SystemExtensions.cs:line 20
   at Squidex.WebStartup.Configure(IApplicationBuilder app) in C:\\GIT\\squidex\\src\\Squidex\\WebStartup.cs:line 41
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()"
  },
  "app": {
    "name": "Squidex",
    "version": "1.0.0.0",
    "sessionId": "d48d200d-a0c9-4e4b-9598-04f7f1eedd75"
  },
  "timestamp": "2018-10-01T08:27:10.0821347Z",
  "category": "Microsoft.AspNetCore.Hosting.Internal.WebHost"
}

It looks fine for me. Btw: If you do not want to wait for the fix you can also use this approach: https://docs.microsoft.com/en-US/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-2.1

Thanks for the tip, and the quick response!

You are welcome. I improved the logging but I cannot reproduce your issue.

Hmm, strange. Ok, I will keep trying and see if it disappears by itself :slight_smile:

Do you use the latest version?

Ah, sorry, didn’t specify that. Build from the latest commit on the master branch at that time (84edeff). Will build from the latest release-tag instead and see if the problem persists.

Hello again. After pulling the latest commit and rebuilding, everything now seems to work. So this one can be closed :slight_smile: