<?xml
version="1.0"?>
<configuration>
<system.web>
<compilation
debug="true"
targetFramework="4.0"
/>
</system.web>
<connectionStrings>
<add
name="connectionString"
connectionString="server=XXX;user
id=zzz;password=aaaa;database=DBNAME; persist security
info=false;Connection TimeOut=3000; "
/>
</connectionStrings>
<system.serviceModel>
<services>
<service
name="TestRestService.Service1"
behaviorConfiguration="XmlServiceBehaviour"
>
<endpoint
address=""
binding="webHttpBinding"
contract="TestRestService.IService1"
behaviorConfiguration="web"></endpoint>
</service>
</services>
<!--END
OF CHANGE #1-->
<bindings
/>
<client
/>
<behaviors>
<serviceBehaviors>
<!--CHANGE
#2-->
<behavior
name="XmlServiceBehaviour">
<!--END
OF CHANGE #2-->
<!--
To avoid disclosing metadata information, set the value below to
false and remove the metadata endpoint above before deployment -->
<serviceMetadata
httpGetEnabled="true"/>
<!--
To receive exception details in faults for debugging purposes, set
the value below to true. Set to false before deployment to avoid
disclosing exception information -->
<serviceDebug
includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<!--CHANGE
#3-->
<endpointBehaviors>
<behavior
name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
<!--END
OF CHANGE #3-->
</behaviors>
<serviceHostingEnvironment
multipleSiteBindingsEnabled="true"
/>
</system.serviceModel>
<system.webServer>
<modules
runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Note:
<!--CHANGE
#1-->
<!-- Name: TestRestService.Service1
is the NameSpace/Class
Behaviour
Config: XmlServiceBehaviour is UserDefined
Contract:
TestRestService.IService1 is NameSpace/Interface-->
<!-- IN Change #2
Change
#2
behavior
name=Change #1 behaviorConfiguration
I.e,
Name=BehaviourConfig-->
and In Interface
[ServiceContract]
public
interface
IService1
{
[OperationContract]
//attribute
for returning JSON format
[WebInvoke(Method
= "GET",
ResponseFormat =
WebMessageFormat.Json,
BodyStyle =
WebMessageBodyStyle.Wrapped,
UriTemplate =
"ListJson/{UserID}")]
string
ListJson(string
UserID);
}