【发布时间】:2010-01-05 20:38:01
【问题描述】:
我需要以编程方式在 asp.net web.config 文件中添加或修改以下部分:
<configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
</configuration>
我可以在 XML 级别操作文件,但我更喜欢尽可能使用配置 API。我在 System.Web.Services.Configuration 命名空间和 System.Web.Services 程序集中都找到了 ProtocolElement 和 ProtocolElementCollection 类,但经过大量谷歌搜索后,我找不到任何使用示例。我在 configSections 元素中定义了 system.web.extensions/scripting/webServices sectionGroup - 这足够了吗,还是我需要在其下添加一个配置部分?
如有任何帮助,我们将不胜感激。我们目前使用的是 ASP.NET 2.0。
【问题讨论】:
标签: asp.net asp.net-2.0