my Service :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Runtime.Serialization;
namespace InterFac
{
[ServiceContract]
//[ServiceBehavior (InstanceContextMode=InstanceContextMode.PerCall,
// ConcurrencyMode = ConcurrencyMode.Multiple)]
public interface ISum
{
[OperationContract]
Int32 sum(Int32 a, Int32 b);
[OperationContract]
string GetSlect();
[OperationContract]
[FaultContract(typeof(CustomException))]
string GetMessage();
}
}
[DataContract]
public class CustomException
{
[DataMember]
public string Problemdesc
{
get;
set;
}
[DataMember]
public string Hlink
{
get;
set;
}
}
===============Definition of GetMessage for Creating the Ex===============
public string GetMessage()
{
try
{
int i, j, k;
j = 1;
k = 0;
i = j / k;
}
catch (Exception exp)
{
CustomException obj = new CustomException();
obj.Problemdesc = exp.Message;
obj.Hlink = "http://www.Microsoft.com";
FaultException
throw o;
//throw new FaultException(exp.Message);
}
return "No Error";
}
========Client Code where service is Calling ==============================
SumClient client = new SumClient();
Response.Write(client.sum(5, 3));
try
{
Response.Write( client.GetMessage());
}
catch (FaultException
{
Response.Write(ex.Detail.Problemdesc + "
" + ex.Detail.Hlink);
}
Suthish NairPosted Feb 11, 2013, 11:49 AM
Mahesh : when we going to kick off the forum moderation?
Mahesh ChandPosted Feb 11, 2013, 7:48 AM
Keep your question title clear and concise. There is no need to have special characters in the title.