I'm having a problem installing a dev version of my Angular/Dotnet app to IIS. It seems like even when building the project as a dev/debug version and running it in IIS, the app informs me via a startup email I've created that it's always in production mode!
Steps to build and install in IIS:
- > ng build --debug -> builds files to a "wwwroot" folder in my dot net API project
- > dotnet publish --configuration Debug -> creates the publish folder with all files in bin folder
- copy and paste 'publish' folder files to IIS folder
- start the app in IIS manager -> see the site running in the browser
Now in my startup.cs file under the configure method, I have created this email code below to send me an email on startup. It's there to inform me if I'm in dev or prod mode. And it keeps saying production.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
using (var client = new SmtpClient())
{
client.Host = email.host.com;
client.Port = 25;
client.EnableSsl = false;
using (var emailMessage = new MailMessage())
{
emailMessage.To.Add(new MailAddress("myemailaddress@email.com"));
emailMessage.From = new MailAddress("Startup@Somewhere.com");
emailMessage.Subject = "Startup in: " + (env.IsDevelopment() ? "Development" : "Production");
emailMessage.Body = "email body";
client.Send(emailMessage);
}
}
}
Am I building the projects incorrectly for dev?