Who said WCF (svc) requires more configuration than a web service (asmx)? When it comes to hosting a simple web service which only purpose is to communicate through Ajax and JSON, this is enough. And no, nothing (related to WCF configuration) needs to be put in the web.config. See MSDN for more details about configuration-less WCF.
Last active
December 18, 2015 16:39
Who said WCF (svc) requires more configuration than a web service (asmx)? When it comes to hosting a simple web service which only purpose is to communicate through Ajax and JSON, this is enough. And no, nothing (related to WCF configuration) needs to be put in the web.config. See http://msdn.microsoft.com/en-us/library/bb472534(v=vs.90).aspx fo…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ServiceModel; | |
using System.ServiceModel.Activation; | |
using System.ServiceModel.Web; | |
namespace Namespace | |
{ | |
[ServiceContract] | |
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] | |
public class HelloService | |
{ | |
[OperationContract] | |
[WebInvoke(Method = "POST")] | |
public string Hello(string name) | |
{ | |
return string.Format("Hello {0}!", name); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ ServiceHost Language="C#" Debug="true" Service="Namespace.HelloService" CodeBehind="HelloService.svc.cs" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment