C# mono上的asp.net:如何添加对程序集的引用
非常基本的问题-但我找不到答案。 我有一个asp.net web服务,它位于asmx文件中。这应该从助手库调用函数。 在VisualStudio中使用不同的asmx文件,一切正常-我只需将程序集添加到该项目的依赖项中 虽然我已将程序集复制到Web服务器上的bin子目录(我想这就是我读过的描述所说的),但它返回以下错误消息: “/”应用程序中的服务器错误 CS0246:类型或命名空间名称 `找不到XXX函数。是 您缺少using指令或 汇编参考 描述:HTTP 500。错误 处理请求 堆栈跟踪: System.Web.Compilation.CompilationException: CS0246:类型或命名空间名称 找不到“C# mono上的asp.net:如何添加对程序集的引用,c#,asp.net,apache,mono,C#,Asp.net,Apache,Mono,非常基本的问题-但我找不到答案。 我有一个asp.net web服务,它位于asmx文件中。这应该从助手库调用函数。 在VisualStudio中使用不同的asmx文件,一切正常-我只需将程序集添加到该项目的依赖项中 虽然我已将程序集复制到Web服务器上的bin子目录(我想这就是我读过的描述所说的),但它返回以下错误消息: “/”应用程序中的服务器错误 CS0246:类型或命名空间名称 `找不到XXX函数。是 您缺少using指令或 汇编参考 描述:HTTP 500。错误 处理请求 堆栈跟踪:
XXXFunctions”。是
您缺少using指令或
汇编参考?在
System.Web.Compilation.AssemblyBuilder.BuildAssembly
(System.Web.VirtualPath VirtualPath,
System.CodeDom.Compiler.CompilerParameters
选项)[0x00000]位于
System.Web.Compilation.AssemblyBuilder.BuildAssembly
(System.Web.VirtualPath VirtualPath)
[0x00000]在
System.Web.Compilation.BuildManager.GenerateAssembly
(System.Web.Compilation.AssemblyBuilder
阿比尔德,
系统.集合.通用.列表
1
buildItems,System.Web.VirtualPath
虚拟路径,BuildKind(BuildKind)
[0x00000]在
System.Web.Compilation.BuildManager.BuildAssembly
(System.Web.VirtualPath VirtualPath)
[0x00000]在
System.Web.Compilation.BuildManager.GetCompiledType
(System.String virtualPath)[0x00000]
在
System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler
(System.Web.HttpContext上下文,
System.String动词,System.String url,
System.String文件路径)[0x00000]在 System.Web.Script.Services.ScriptHandlerFactory.GetHandler (System.Web.HttpContext上下文, System.String请求类型, System.String url,System.String 路径翻译)[0x00000]位于 System.Web.HttpApplication.GetHandler (System.Web.HttpContext上下文, 字符串url,布尔值 ignoreContextHandler)[0x00000]位于 System.Web.HttpApplication.GetHandler (System.Web.HttpContext上下文, System.String url)[0x00000]位于 System.Web.HttpApplication+c__迭代器2.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);
}
}
}
使用制度;
使用系统集合;
使用System.Collections.Generic;
使用System.Web;
使用System.Web.Services;
使用System.Web.Script.Services;
使用System.Runtime.Serialization;
使用System.Runtime.Serialization.Json;
使用System.IO;
使用系统文本;
命名空间FCWService
{
[WebService(命名空间=”http://tempuri.org/NumberService")]
[WebServiceBinding(ConformsTo=WsiProfiles.BasicProfile1_1)]
[脚本服务]
公共类FCWService:System.Web.Services.WebService
{
[网络方法]
[ScriptMethod(ResponseFormat=ResponseFormat.Json)]
公共XXX函数。数据获取数据(双倍长度)
{
返回XXXFunctions.Functions.GetData(长度);
}
}
}
有什么想法吗
回答:
我发现asmx页面顶部缺少一条指令。您确定复制了所需的所有内容吗?服务器上似乎缺少一个名为XXXFunctions的名称空间或东西。回答:我发现asmx页面顶部缺少一条指令 在bin子目录中添加额外的二进制文件后,我是否必须重新启动服务器?我认为他没有包括搜索此名称空间的文件