Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

Config files for

$
0
0

I am working on some legacy code in .Net Framework 4.7.1 and trying to access app settings from MyActivity.dll.config. When that code below is executed, it returns an empty string.

var string = ConfigurationManager.AppSettings["SMTPServer"]

I did some logging to a text file and verified it is coming back blank. I also checked for the presence of said config file being in the same directory as MyActivity.dll. Lastly, I checked and logged within the code the path of the assembly and it was in a weird place (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\7d28ecb5\9e49f345\assembly\dl3\1e60f07b\5ff4cf31_9738d801\MyActivity.dll). For grins, I also placed a copy of the config file in there and nothing different happened. Below is a snippet of the config file.

<?xml version="1.0" encoding="utf-8"?><configuration><appSettings><add key="SMTPServer" value="smtp.office365.com"/></appSettings></configuration>

Anyone have any clue as to what may resolve this. Much thanks in advance!


Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>