mod_mono 问题:无法解析名称“ConfigurationManager”

发布于 2024-09-24 06:20:02 字数 967 浏览 3 评论 0原文

我在 Ubuntu 上运行 mod_mono 2.4.4,我发现我必须检查 VB 文件并向所有文件添加“imports System.Configuration”才能解决名称错误。这在 Windows 端的 mod_aspdotnet 中是不必要的。

 I have, however, run into one error of which I can't find the source:


    System.Web.Compilation.CompilationException: VBNC30451: Could not resolve the name 'ConfigurationManager'
  at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath, System.CodeDom.Compiler.CompilerParameters options) [0x00000] 
  at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000] 
  at System.Web.Compilation.BuildManager.GenerateAssembly (System.Web.Compilation.AssemblyBuilder abuilder, System.Collections.Generic.List`1 buildItems, System.Web.VirtualPath virtualPath, BuildKind buildKind) [0x00000] 
  at System.Web.Compilation.BuildManager.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000] 

这是由于遗漏步骤或配置不正确导致我必须继续添加此导入吗?

I'm running mod_mono 2.4.4 on Ubuntu and I'm finding that I've had to go through my VB files and add "imports System.Configuration" to all of them to resolve the name error. This was not necessary in mod_aspdotnet on the Windows side.

 I have, however, run into one error of which I can't find the source:


    System.Web.Compilation.CompilationException: VBNC30451: Could not resolve the name 'ConfigurationManager'
  at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath, System.CodeDom.Compiler.CompilerParameters options) [0x00000] 
  at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000] 
  at System.Web.Compilation.BuildManager.GenerateAssembly (System.Web.Compilation.AssemblyBuilder abuilder, System.Collections.Generic.List`1 buildItems, System.Web.VirtualPath virtualPath, BuildKind buildKind) [0x00000] 
  at System.Web.Compilation.BuildManager.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000] 

Is this the result of a missed step or incorrect configuration that I have to keep adding this import?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南笙 2024-10-01 06:20:02

某个地方,可能是/etc/mono/2.0/web.config,有一个默认配置文件。验证它是否包含类似以下内容:

             <pages>
                    <namespaces>
                            <add namespace="System" />
                            <add namespace="System.Collections" />
                            <add namespace="System.Collections.Specialized" />
                            <add namespace="System.Configuration" />
                            <add namespace="System.Text" />
                            <add namespace="System.Text.RegularExpressions" />
                            <add namespace="System.Web" />
                            <add namespace="System.Web.Caching" />
                            <add namespace="System.Web.SessionState" />
                            <add namespace="System.Web.Security" />
                            <add namespace="System.Web.Profile" />
                            <add namespace="System.Web.UI" />
                            <add namespace="System.Web.UI.WebControls" />
                            <!-- <add namespace="System.Web.UI.WebControls.WebParts" /> -->
                            <add namespace="System.Web.UI.HtmlControls" />
                    </namespaces>
            </pages>

这是默认值。这应该负责添加默认导入。

顺便说一句,mod_mono 2.4.4 现在有点旧了。尝试获取更新的软件包。

Somewhere, probably /etc/mono/2.0/web.config, there's a default configuration file. Verify that it contains something like this:

             <pages>
                    <namespaces>
                            <add namespace="System" />
                            <add namespace="System.Collections" />
                            <add namespace="System.Collections.Specialized" />
                            <add namespace="System.Configuration" />
                            <add namespace="System.Text" />
                            <add namespace="System.Text.RegularExpressions" />
                            <add namespace="System.Web" />
                            <add namespace="System.Web.Caching" />
                            <add namespace="System.Web.SessionState" />
                            <add namespace="System.Web.Security" />
                            <add namespace="System.Web.Profile" />
                            <add namespace="System.Web.UI" />
                            <add namespace="System.Web.UI.WebControls" />
                            <!-- <add namespace="System.Web.UI.WebControls.WebParts" /> -->
                            <add namespace="System.Web.UI.HtmlControls" />
                    </namespaces>
            </pages>

Which is the default. That should take care of adding the default imports.

Btw, mod_mono 2.4.4 is a bit old these days. Try getting newer packages.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文