TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ALOK SHARMA
NA
51
12.6k
WCF error
Feb 3 2014 11:44 AM
Hi ,
I am getting an error while invoking WCF service i am inserting values into database but getting an error
There was no endpoint listening at http://localhost:8983/ServiceCrud.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Server stack trace:
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IService1Crud.Create(EmployeeInfo Employe)
at Service1CrudClient.Create(EmployeeInfo Employe)
My code is here
Iservice1Crud.cs
namespace WcfServiceEdit
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IService1Crud
{
[OperationContract]
void Create(EmployeeInfo Employe);
[DataContract]
public class EmployeeInfo
{
[DataMember]
public int Id
{
get { return Id; }
set { Id = value; }
}
[DataMember]
public string Name
{
get { return Name; }
set { Name = value; }
}
[DataMember]
public string Address
{
get { return Address; }
set { Address = value; }
}
}
}
Sevice.crud.svc.cs
namespace WcfServiceEdit
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
public class Service1 : IService1Crud
{
public void Read(EmployeeInfo Employe)
{
public void Create(EmployeeInfo Employe)
{
SqlConnection con = new SqlConnection(@"Data Source=SONY-VAIO\SQLEXPRESS;Initial Catalog=Employee;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("Insert Editt( Name,Address)Values(@Name,@Address)", con);
cmd.Parameters.AddWithValue("@Name", Employe.Name);
cmd.Parameters.AddWithValue("@Address", Employe.Address);
cmd.ExecuteNonQuery();
con.Close();
}
Thanks in advance
Reply
Answers (
2
)
ConnectionString
After hosting application WCF service getting error