WebConfigurationManager.OpenWebConfiguration()-无法解析站点ID [英] WebConfigurationManager.OpenWebConfiguration() - Failed to resolve the site ID
问题描述
大家好,
我编写了一个Win Forms应用程序,该应用程序用于使用RSA加密各种Web配置文件-利用Microsoft Server2008.问题是,当尝试使用configuraiton文件时,我收到了以下异常(我没有使用默认网站)-在代码的以下行中:
Hi all,
I have written an Win Forms applicaiton that is used to encrypt various web configuration files with RSA - making use of Microsoft Server 2008. The thing is that I have receive the following exception when trying to opne the configuraiton file (I am not making use of the Default Web site) - on the following line in the code:
Configuration config = WebConfigurationManager.OpenWebConfiguration("/", "SiteName", null, Enviorement.MachineName);
奇怪的是,它可以在另一台Microsoft Server 2008计算机上运行(测试环境),但是客户端服务器会给出异常.
我查看了以下网站( ^ ]),但未提供答案.
谁能帮我吗?
提前非常感谢.
亲切的问候,
The strange thing is that it works on another Microsoft Server 2008 machine (Testing enviorement), but the clients Server gives the exception.
I have looked at the following web sites (WebConfigurationManager.OpenWebConfiguration() - Failed to resolve the site ID
[^]) but did not provide an answer.
Could anyone please help me?
Many thanks in advance.
Kind regards,
推荐答案
在"/"之前添加一个@,因为正斜杠可能会转义字符串
Add a @ before the "/" as the forward slash is probably escaping the string
这篇关于WebConfigurationManager.OpenWebConfiguration()-无法解析站点ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!