0
votes

I created a Wcf Service Library. There are Service1 and IService1 class and interface in it.

Service:

public class Service1 : IService1
{
    public string InsertData(string Name, string Email, string Message)
    {
        XDocument xDoc = XDocument.Load(HttpContext.Current.Server.MapPath("DataFile.xml"));
        xDoc.Element("Users").Add(
           new XElement("User",
                new XAttribute("Name", Name),
                new XAttribute("Email", Email),
                new XAttribute("Message", Message)));
        xDoc.Save(HttpContext.Current.Server.MapPath("DataFile.xml"));
        return "Registered Successfully";
    }
}

Iservice:

[ServiceContract]
public interface IService1
{
    [OperationContract]
    string InsertData(string Name, string Email, string Message);
}   

I followed this article. After this i have added an another project and added Service reference there and add text file as named AjaxService.svc

<%@ ServiceHost Debug="true" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" Language="C#" Service="DataServices.Service1" %>

But when i am running this file in the browser:

enter image description here

1
what is DataServices?Sajeetharan
It is the namespace name. @Sajeetharan]Nimit Joshi
Upload your code somehwehre, its hard to find the issueSajeetharan
which code do you want to see? @SajeetharanNimit Joshi

1 Answers

0
votes

Thank god. I solved my problem:

I have just copied all files from Target folder and paste them to the Project.

copy "$(TargetDir)*.dll" "$(ProjectDir)bin"
copy "$(TargetDir)*.pdb" "$(ProjectDir)bin"
copy "$(TargetDir)*.config" "$(ProjectDir)bin"