Where is Web.config during development? - asp.net-core

When I publish my ASP .Net Core 1.1 MVC web app, I see the Publish folder contain a Web.config file, where I can set stdoutLogEnabled, etc. However, while developing I don't see this file at all - it looks like it's being generated when publishing... How can I therefore set the variables in this file without having to manually edit the file after each publish?

Web.config only makes sense if you host the app on Windows with IIS. You have to manually add it to the project to edit the file's contents or it will be auto-generated:
Documentation:
If you don't have a web.config file in the project when you publish with dotnet publish or with Visual Studio publish, the file is created for you in published output. If you have the file in your project, it's transformed with the correct processPath and arguments to configure the ASP.NET Core Module and moved to published output. The transformation doesn't touch IIS configuration settings that you've included in the file.

Related

How to create installer for ASP.NET Core windows service?

I want to create installer that will install my ASP.Net Core 3.1 app as windows service (the app code already has .UseWindowsService();).
Right now when i publish the app, there are a lot of files and i just use sc create command in cmd to install it as service (specifying .exe path).
I want to create just one exe file that will include installer and files needed for installation. I would like to have some basic ui where you could choose path if you want different path than default. It should start service after installation and set it to start automatically. Before installation it should check if service is already installed and if it is, try to start it and inform user about it.
The located at https://github.com/iswix-llc/iswix-tutorials will handle this. Build your EXE to not require .net core. If you want to install .net core as a prereq instead you'll want to use the IsWiX bootstrapper project template and add .net core to your bundle.wxs.
This short video shows the whole process that's described in the tutorial.
https://www.youtube.com/watch?v=bxbcPnjfzIc

How to publish .net core project to smarterasp.net from vscode?

I need to publish .net core project to smarterasp.net server. I use visual studio code. How can I deploy my project?
I've run into bugs with Web Deploy, so I use a Folder (aka 'File') deploy to a local folder and then FTP the content of that folder to the root website folder at SmarterASP.NET. The main trick is that when you set up your publishing profile, you must change to 'self contained' and target x86. If you leave the default settings, your site won't work. I'm referring to Core 3 here....
since I don't know the smarterasp.net provider, but unless you have a free hosting plan, smarterasp.net declares that ASP.NET Core 3.x is already installed for which you only need to build your project and inserting it in the root of your IIS site without installing the core framework on the server would not work.
Good luck.

Asp .Net Core Fail to delete file during publish using File System

I am deploying to IIS using file system but i get error on deleting the current dll files on iis folder.
I read that the app needs to add the app_offline.html file to do this and that i need to add
<WebPublishMethod>FileSystem</WebPublishMethod>
<EnableMSDeployAppOffline>True</EnableMSDeployAppOffline>
somewhere when using filesystem. I can't find any information about this tho, i tried doing it on csproj file but no luck.
The <EnableMSDeployAppOffline> requires Web Deploy. If you're doing a filesystem publish, it's not going to have any effect. You need to either publish via Web Deploy, or manually stop the App Pool, move the files, and then start it up again.

How can my published folder automatically update when I compile my ASP.NET Core 3 application?

I have an asp.net core 3 application deployed on IIS. I made this by publishing the website on a separate folder, and reference that folder when I added a new application in IIS. It works, I can access it from different computers, but this folder doesn't get updated when I'm doing modifications and compile the project. I always have to publish it whenever I make small modifications. How can I overcome this situation?
This is how my folder looks like after publishing my project.

Deploying external files from visual studio with .NET CF application

I am working on a .NET CF 3.5 application. There are few external files\assemblies that the application is consuming. These files are not part of the project, therefore while debugging when I deploy the project, these external files are not deployed to the device.
Is there any way I can deploy these files with project without including them in the project?
You can't get Studio to deploy arbitrary files without telling it what files to deploy. The only way to tell Studio to deploy files is to either add the files to the project (as a Resource or a Content file) or by adding a reference to them (for .NET assemblies).