Kan ikke oprette objekt i min webservice
Jeg kan ikk køre en wsdl når jeg opretter et objekt i min webservice...Hvis jeg udkommenterer linien virker det fint..
Hvad er galt....
Projekt mappen ser således ud
-----------------------------
NMS_System_Project
+Properties
+References
+Web References
app.config
Class2.cs
NMS_Service.cs
min webservice
---------------------------------
<%@ WebService language="C#" class="NMS_WebService" %>
using System;
using System.Web.Services;
using System.Xml.Serialization;
[WebService(Namespace="http://localhost/NMS_System/")]
public class NMS_WebService : WebService
{
private int i;
private Class2 c = new Class2();
[WebMethod]
public int sub(int a, int b)
{
return a-b;
}
[WebMethod]
public int add(int a, int b)
{
return a + b;
}
[WebMethod]
public String helloString()
{
return "Hello World";
}
}
-----------------------------------------
En klasse i oprette i en anden fil Class2.cs
----------------------------------------
using System;
/// <summary>
/// Summary description for Class1
/// </summary>
///
namespace NMS_System
{
public class Class2
{
public Class2()
{
//
// TODO: Add constructor logic here
//
}
}
}
---------------------------------------------
dette skrives der når wsdl fejler
[HttpCompileException]: c:\Programmer\Apache Group\Apache2\htdocs\NMS_System\NMS_WebService.asmx(13): error CS0246: The type or namespace name 'Class2' could not be found (are you missing a using directive or an assembly reference?)
at System.Web.Compilation.AssemblyBuilder.Compile()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
