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
Shreyas Tg
NA
18
6.5k
ServiceReference issues in Web Application while using wcf s
Oct 16 2015 6:01 AM
I have developed a simple Web Application using wcf services which has basic `Insert` and `Delete` functionalities.
>I had two Project in my Solution 1)WCFService and 2)Web Application.
Now i have added a new project ie. `Class Library` where in i have Some `DataType Objects(DTO).`
I have added the reference to both of the other two Solutions.
Now in my Web App i have two service references which was previously added. In one of my aspx.cs page i have below code
ServiceReference2.ShowDetailsClient objDisplayUser = new ServiceReference2.ShowDetailsClient();
UserDetails1 User = new UserDetails1();
List<UserDetails> result = objDisplayUser.DisplayDetails(User);
`UserDetails1 User = new UserDetails1();` will come from the DTO file.
In code mentioned above i get an error in last line mentioning that method has invalid arguments.
So i crosschecked it and came to conclusion that `ShowDetailsClient(from metadata)` has
`public List<UserDetails> DisplayDetails(UserDetails User);`
where in UserDetails was previously used now i added a new DTO where in it has UserDetails1 User
I tried to Update Service Reference still its not working. How to resolve this issue.?
Code Behind
DTO file
namespace Demo.DTO
{
[DataContract]
public class UserDetails1
{
string username = string.Empty;
string password = string.Empty;
string country = string.Empty;
string email = string.Empty;
[DataMember]
public string UserName
{
get { return username; }
set { username = value; }
}
[DataMember]
public string Password
{
get { return password; }
set { password = value; }
}
.cs file
using Demo.DTO;
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ShowDetails" in code, svc and config file together.
namespace WcfService1
{
public class ShowDetails:IShowDetails
{
SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString);
public List<UserDetails> DisplayDetails(UserDetails1 User)
{
var result = new List<UserDetails>();
con.Open();
aspx.cs
ServiceReference1.Service1Client objNewService = new ServiceReference1.Service1Client();
string result = objNewService.InsertUserDetails(User);//error this line
Service1Client
#region Assembly App_WebReferences.bzq1_cfc.dll, v4.0.30319
// C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\demoinsert\f96d44f6\_shadow\d6b3204d\451837185\30476278\App_WebReferences.bzq1_cfc.dll
#endregion
using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.ServiceModel;
using System.ServiceModel.Channels;
namespace ServiceReference1
{
[GeneratedCode("System.ServiceModel", "4.0.0.0")]
[DebuggerStepThrough]
public class Service1Client : ClientBase<IService1>, IService1
{
public Service1Client();
public Service1Client(string endpointConfigurationName);
public Service1Client(Binding binding, EndpointAddress remoteAddress);
public Service1Client(string endpointConfigurationName, EndpointAddress remoteAddress);
public Service1Client(string endpointConfigurationName, string remoteAddress);
public string InsertUserDetails(UserDetails userInfo);
}
}
Reply
Answers (
0
)
Add drop down list in excel file through vb.net?
dataset error