0

I need to log some funcionality in my web API published in IIS so I have this in startup.cs

fileLog = @"c:\inetpub\wwwroot\planificadorwebapi\planificadorLog.json";

  Log.Logger = new LoggerConfiguration()
    .ReadFrom.Configuration(Configuration)
    .WriteTo.File(new JsonFormatter(), fileLog, shared: true)
    .CreateLogger();

I try to creat the file in the folder of the application but this file is never created. I make requests that log information but the file does not exist

When I start the application in Visual Studio the file is created and this works perfectly

Any idea please?

Regards

3
  • 1
    Check your IIS application pool Indentity user if has access permission on your designated folder Commented Dec 4, 2019 at 13:16
  • also search "Serilog SelfLog" to ease diagnosing this (also Sysinternals Filemon can be useful in this space) Commented Dec 4, 2019 at 17:22
  • In my Application the identity is asigned to "ApplicationPoolIdentity" I don't know to which user this corresponds. IIS_IUSRS maybe? Commented Dec 5, 2019 at 15:36

1 Answer 1

1

I did permission to write int the folder of the application to the account IIS_IUSRS and now the file is created well

Thanks

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.