Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.net mvc web.config and web.debug.config difference

There are Web.config and Web.debug.config and Web.release.config files in my visual studio solution window.

I want to set different email configurations for release and debug.

So I set Web.debug.config file

  <system.net>
    <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory">
        <network host="localhost" port="587" defaultCredentials="true"/>
        <specifiedPickupDirectory pickupDirectoryLocation="C:\Temp\Mail\Debug"/>
      </smtp>
    </mailSettings>
  </system.net>

And I set my Web.release.config

  <system.net>
    <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory">
        <network host="localhost" port="587" defaultCredentials="true"/>
        <specifiedPickupDirectory pickupDirectoryLocation="C:\Temp\Mail\Release"/>
      </smtp>
    </mailSettings>
  </system.net>

When I run the applciaitons, my settings does not load to SmtpClient object.

Why does not take settings from Web.debug.config

enter image description here

like image 371
barteloma Avatar asked Nov 17 '25 11:11

barteloma


1 Answers

This only works for when you publish a project, not in the IDE. Read more here:

https://msdn.microsoft.com/en-us/library/dd465318(v=vs.100).aspx

like image 104
Xavier J Avatar answered Nov 20 '25 01:11

Xavier J



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!