【问题标题】:asp.net on mono: how to add a reference to an assembly单声道上的 asp.net:如何添加对程序集的引用
【发布时间】:2009-08-06 14:48:31
【问题描述】:

非常基本的问题 - 但我找不到答案。 我有一个位于 asmx 文件中的 asp.net Web 服务。这应该从帮助程序库中调用一个函数。 在 Visual Studio 中使用不同的 asmx 文件一切正常 - 我只需将程序集添加到该项目的依赖项中。

尽管我已将程序集复制到网络服务器上的 bin 子目录(我认为这是我读过的描述所说的),但它返回此错误消息:

“/”应用程序中的服务器错误 CS0246:类型或命名空间名称 找不到“XXXFunctions”。是 您缺少 using 指令或 汇编参考?

描述:HTTP 500。错误 处理请求。

堆栈跟踪:

System.Web.Compilation.CompilationException: CS0246:类型或命名空间名称 XXXFunctions' could not be found. Are you missing a using directive or an assembly reference? 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.List1 buildItems,System.Web.VirtualPath virtualPath, BuildKind buildKind) [0x00000] 在 System.Web.Compilation.BuildManager.BuildAssembly (System.Web.VirtualPath 虚拟路径) [0x00000] 在 System.Web.Compilation.BuildManager.GetCompiledType (System.String virtualPath) [0x00000] 在 System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler (System.Web.HttpContext 上下文, System.String 动词,System.String 网址, System.String filePath) [0x00000]
在 System.Web.Script.Services.ScriptHandlerFactory.GetHandler (System.Web.HttpContext 上下文, System.String 请求类型, System.String 网址,System.String pathTranslated) [0x00000] 在 System.Web.HttpApplication.GetHandler (System.Web.HttpContext 上下文, System.String url,布尔值 ignoreContextHandler) [0x00000] 在 System.Web.HttpApplication.GetHandler (System.Web.HttpContext 上下文, System.String url) [0x00000] 在 System.Web.HttpApplication+c__Iterator2.MoveNext () [0x00000]

这是我正在使用的 asmx 文件:

<%@ Assembly name="System.Web.Extensions" %>
<%@ Assembly name="System.Runtime.Serialization" %>
<%@ Assembly name="System.ServiceModel.Web" %>
<%@ WebService Language="C#" Class="FCWService.FCWService" %>

using System;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.IO;
using System.Text;

namespace FCWService
{
    [WebService (Namespace = "http://tempuri.org/NumberService")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ScriptService]
    public class FCWService : System.Web.Services.WebService
    {
        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public XXXFunctions.Data GetData(double length)
        {
            return XXXFunctions.Functions.GetData(length);
        }
    }
}

有什么想法吗?


回答: 我发现 asmx 页面顶部缺少一个 指令。

【问题讨论】:

    标签: c# asp.net apache mono


    【解决方案1】:

    你确定你复制了你需要的一切吗?服务器上似乎缺少命名空间或名为 XXXFunctions 的东西。

    【讨论】:

    • 在 bin 子目录中添加额外的二进制文件后我是否必须重新启动服务器 - 它看起来我他没有包含用于搜索此命名空间的文件
    【解决方案2】:

    回答:我发现 asmx 页面顶部缺少 指令。

    【讨论】:

      猜你喜欢
      • 2014-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-05
      • 2016-01-13
      • 1970-01-01
      相关资源
      最近更新 更多