Coding Horror posted by:
Mani5155 | Posted on: 4/12/2012 | Category:
WCF | Views: 2981 | Level:
Starter | Status:
[Member] |
Points: 75
|
Alert Moderator
/// example of web service
public class Service1 : IService1
{
public string GetData( int value )
{
return string.Format( "You entered: {0}", value );
}
public CompositeType GetDataUsingDataContract( CompositeType composite )
{
if( composite == null )
{
throw new ArgumentNullException( "composite" );
}
if( composite.BoolValue )
{
composite.StringValue += "Suffix";
}
return composite;
}
}
//example in controller
public ActionResult Index()
{
SettingsModel config = null;
// Set up a channel factory to use the webHTTPBinding
using (WebChannelFactory serviceChannel =
new WebChannelFactory(new Uri(baseServiceUrl )))
{
IChangeService channel = serviceChannel.CreateChannel();
config = channel.GetSysConfig();
}
ViewBag.Message = "Service Configuration";
return View(config);
}
<iframe src="https://www.mcpvirtualbusinesscard.com/VBCServer/manivannanm/interactivecard"/>
Found interesting? Add this to: