Recommended Litium 8 dev environment setup

I’m trying to set up a Litium 8 local development environment. I should mention that I’m new to .NET Core but from what I understand there seem to be a whole bunch of alternatives how you can run your application. Is there a recommended way when running Litium Accelerator 8, how to do it?

I’ve tried some different alternatives but none of them seem to work flawlessly for me. My first choice was going with running it from IIS because that’s the way I’ve done it in previous Litium versions. It works well except that after the site has been started I can’t rebuild the solution. Files in Litium.Accelerator.Mvc/bin/Debug/net6.0/ are locked by a IIS Worker process. The lock seems to be released after a few minutes and you could probably kill/restart the process to release it as well but that’s not really a long time solution. Anyone else experienced this problem and solved it?

Litium version: 8.3.1

Are you running Visual Studio as Administrator? In my experience, it will then stop the application pool automatically when building the solution.

In .net5 I had to have this installed. Probably the same in .net6

Yes, I always run VS as an administrator. But I have never seen that “Stopping the IIS application pool” window. When does that show up?

I have that. Do I need to turn something on inside VS as well? Or maybe configure something in the solution?

You need this in your launchSettings.json, more then that I do not know what could be wrong.

image

Yey, that did the trick. Thanks. Not sure how I missed that with all the googling I’ve done.

1 Like

A follow up question. How do you work with multiple developers working on the same solution with different appsettings, for example different credentials in the connectionstring or defferent ports for Redis or Elasticsearch?

In appsettings.Development.json it refered to using “User Secrets” but that doesn’t seem to work well when using IIS.

Don’t have any good answer on that, I would expect appsettings.Development.json works if you have this in your web.config. But I have not tried to transform the appsettings locally.

          <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />

Yes, appsettings.Development.json works when having that environment variable in web.config but that will hold the same information for all developers. One solution would be to never commit appsettings.Development.json to the source code system and let every developer have there own locally. I’ve only tried it locally in my environment but that seems to work.

I think setting the ASPNETCORE_ENVIRONMENT is the correct way, though I wouldnt do this in the web.config file, i would do it on IIS/Site level or if you running docker, as an ENVIRONMENT variable.

Exclude your appsettings.development.json file and keep that as per developer per machine! Should be all you have to do!

Also on your launchsettings profiles you could set “workingDirectory” to your MVC site, that will make it possible to have the launchsettings file checked in and still point to the same MVC project even if developers have their repo folder on different locations :slight_smile:

Example something like this:

“Local IIS Profile”: {
“commandName”: “IIS”,
“workingDirectory”: “.\…\…\Src\Litium.Accelerator.Mvc”, //relative path :muscle:
“launchBrowser”: true,
“environmentVariables”: {
“ASPNETCORE_ENVIRONMENT”: “Development”
}
}

Using user secrets are not “supported” when using IIS regarding this issue and in the bottom of that issue you have a workaround that describe how you can manage to get it to work with custom identity on the app-pool. And in that case, if you app-pool using the same identity that you are signed in with, then I think it will read from the same location as Kestrel are doing.

Not sure that “workingDirectory” is of any use when running IIS. The directory is set when the application is created in the IIS. I haven’t used “workingDirectory” at all and it seems to run anyway.

It would be interesting to know if it’s possible for developers to have different iisSettings though. The applicationUrl could possibly differ between developers.

Yes, I saw that solution. It looks a bit too “hacky” for my taste.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.