相关疑难解决方法(0)

在ASP.NET中,什么决定了HostingEnvironment.IsDevelopmentEnvironment的价值?

MSDN文档没有解释如何,何时以及为什么这个值设置为true.

设置<configuration debug="false" />在web.config中的属性不会设置为false,也没有设置<deployment retail="true" />在machine.config中.

我在IIS Express上运行Visual Studio 2012中的测试网站,我没有安装IIS'正确'.

编辑:在回顾奥斯卡的答案并进行更多研究之后,似乎设置<deployment retail="true" />应该覆盖,所以当我问这个问题时,我可能没有在正确的框架的machine.config中设置它.

asp.net

15
推荐指数
1
解决办法
1766
查看次数

如何判断代码是否从Visual Studio/Cassini本地运行

我有一个接口,让我们称之为ILocateLogFiledev/beta/production服务器的标准实现,以及仅在本地开发环境中工作的接口.如果我在本地或在服务器上运行,我似乎无法想出一个很好的干净方式来决定(最好是在编译时,但运行时会没问题).如果这很重要,这是在IIS上托管的WCF应用程序.

我提出的最好的是使用编译器符号,如:

    ILocateLogFile locateLogFile;
#if DEBUG
    locateLogFile = new DevSandboxLogFileLocator();
#else
    locateLogFile = new LogFileLocator();
#endif
Run Code Online (Sandbox Code Playgroud)

问题是,编译符号由构建设置,我无法控制,我想确定.是否有一些自动方法来检查Visual Studio的存在?或者至少检查一下卡西尼而不是IIS?

c# iis wcf compiler-directives visual-studio

6
推荐指数
1
解决办法
3273
查看次数

asp.net c#优雅的自动方式不发送邮件

是否有一种优雅的自动方式如何不发送 MailMessage 电子邮件而不将其注释掉?每次我在使用 MailMessages 的页面中测试某些内容时,我都不想修改我的代码。

c# asp.net email debugging

0
推荐指数
1
解决办法
116
查看次数

标签 统计

asp.net ×2

c# ×2

compiler-directives ×1

debugging ×1

email ×1

iis ×1

visual-studio ×1

wcf ×1