Very basic question – but I couldn't find an answer.
I have got a asp.net web service which is located in an asmx file. This should call a function from a helper library.
Using a different asmx file in Visual Studio everything is working fine – I just had to add the assembly to the dependencies of this project.
Altough I have copied the assembly to the bin subdirectory on the webserver (I think this was what the descriptions I've read said) it returns this error message:
Server Error in '/' Application
CS0246: The type or namespace name
`XXXFunctions' could not be found. Are
you missing a using directive or an
assembly reference?Description: HTTP 500. Error
processing request.Stack Trace:
System.Web.Compilation.CompilationException:
CS0246: The type or namespace name
XXXFunctions' could not be found. Are
1
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.List
buildItems, System.Web.VirtualPath
virtualPath, BuildKind buildKind)
[0x00000] at
System.Web.Compilation.BuildManager.BuildAssembly
(System.Web.VirtualPath virtualPath)
[0x00000] at
System.Web.Compilation.BuildManager.GetCompiledType
(System.String virtualPath) [0x00000]
at
System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler
(System.Web.HttpContext context,
System.String verb, System.String url,
System.String filePath) [0x00000]
at
System.Web.Script.Services.ScriptHandlerFactory.GetHandler
(System.Web.HttpContext context,
System.String requestType,
System.String url, System.String
pathTranslated) [0x00000] at
System.Web.HttpApplication.GetHandler
(System.Web.HttpContext context,
System.String url, Boolean
ignoreContextHandler) [0x00000] at
System.Web.HttpApplication.GetHandler
(System.Web.HttpContext context,
System.String url) [0x00000] at
System.Web.HttpApplication+c__Iterator2.MoveNext
() [0x00000]
This is the asmx file I'm using:
<%@ 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);
}
}
}
Any ideas ?
Answered:
I found out that there was a <%@ Assembly name="XXXFunctions" %> directive was missing on top the asmx page.
Best Answer
Are you sure you copied everything you needed? There seems to be a namespace or something called XXXFunctions that's missing on the server.