非常基本的問題 - 但我找不到答案。 我有一個位於asmx文件中的asp.net web服務。這應該從助手庫調用一個函數。 在Visual Studio中使用不同的asmx文件一切工作正常 - 我只需將程序集添加到此項目的依賴項。asp.net on mono:如何添加對程序集的引用
Altough我抄裝配到bin子目錄在Web服務器上(我認爲這是我讀過的描述中說的),它返回此錯誤信息:在「/」應用
服務器錯誤 CS0246:類型或命名空間名稱 找不到`XXXFunctions'。 是否缺少使用指令或 程序集參考?
描述:HTTP 500.錯誤 處理請求。
堆棧跟蹤:
System.Web.Compilation.CompilationException: CS0246:類型或命名空間名稱 buildItems,System.Web.VirtualPath 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的RequestType, System.String URL,System.String pathTranslated)[0x00000]在 System.Web.HttpApplication.GetHandler (System.Web程序.HttpContext上下文, System.String url,布爾 ignoreContextHandler)[0x00000]在 S ystem.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);
}
}
}
任何想法?
回答: 我發現有一個<%@大會名稱=「XXXFunctions」%>指令失蹤頂部的ASMX頁面上。
是否必須在bin子目錄中添加其他二進制文件後重新啓動服務器 - 它尋找我他不包括搜索此名稱空間的文件 – bernhardrusch 2009-08-07 08:29:28
謝謝 - 我錯過了<%@ Assembly name =「XXXFunctions 「%>陳述... – bernhardrusch 2009-08-07 08:45:34