modify build.bat file

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
darkdragon
User
Posts: 150

modify build.bat file

Post by darkdragon »

Hi,

Is there any possibility to modify the build.bat file?
We wont to include some command to kill the IIS worker processes, as we mostly test in IIS as we need Windows Integrated credentials.

The dotnet --publish command is unable to overwrite the main dll, therefore we need to restart App Pool or kill the w3wp process


MichaelG
User
Posts: 1111

Post by MichaelG »

You can add listeners to the BeginGenerate / EndGenerate events in usercode to stop/start IIS. Read:
https://aspnetmaker.dev/docs/#/usercode.html

For example:

const ExecSync = require("child_process").execSync;

Events.on("BeginGenerate", () => {
    ExecSync("iisreset /stop");
});

Events.on("EndGenerate", () => {
    ExecSync("iisreset /start");
});

Make sure that you have Administrative rights when running iisreset.


darkdragon
User
Posts: 150

Post by darkdragon »

Great! It works!
Another way to ensure publishing to IIS is to kill (all) worker processes

const ExecSync = require("child_process").execSync;

Events.on("EndGenerate", () => {
ExecSync("taskkill /IM w3wp.exe /F");
});

Post Reply