c# - Using a Wcf Service in web application -


i created wcf service library. there service1 , iservice1 class , 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 have added project , added service reference there , add text file named ajaxservice.svc

<%@ servicehost debug="true" factory="system.servicemodel.activation.webscriptservicehostfactory" language="c#" service="dataservices.service1" %> 

but when running file in browser:

enter image description here

thank god. solved problem:

i have copied files target folder , paste them project.

copy "$(targetdir)*.dll" "$(projectdir)bin" copy "$(targetdir)*.pdb" "$(projectdir)bin" copy "$(targetdir)*.config" "$(projectdir)bin" 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -