Azure upgrade from 1.3 to 1.7 issue
I have recently upgraded our Azure solution to use the new 1.7 SDK. CSPack warned that it was running on a legacy syntax and required a definition in the service definition to run under full IIS. Here's what I added.
<Sites> <Site name="Web" physicalDirectory="..\Portal\MyApp.Portal"> <Bindings> <Binding name="HttpIn" endpointName="HttpIn" /> </Bindings> </Site> </Sites>
The web role is an MVC3 application with the following mail settings defined in web.config.
<system.net> <mailSettings> <smtp deliveryMethod="Network"> <network host="smtp.gmail.com" userName="email@example.com" enableSsl="true" port="587" password="mypassword"/> </smtp> </mailSettings>
These settings are pulled fine from web.config for sending emails from code by just declaring a SMTP client and using it to send emails,
SmtpClient client = new SmtpClient();
But when I add the section to the service definition the setting are not used and I get a SMTP host was not specified every time an email is attempted. The new SmtpClient() has none of the settings from config. I can not figure out how to fix this nor can I find any info elsewhere.
Try changing the name of your site to anything other than "Web".
There's a poorly documented feature of this syntax that a site with the name of "Web" will have all of it's settings like physicalDirectory ignored. If this works it might pay to think about whether or not you actually need the physicalDirectory specified.