Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi friends,
i added wcf service application to my solution...i removed .svc file and Added UserService.cs and IUserService.cs classes..if i run solution i am not getting end point...i want to add UserServiceReference to .net project

Here is my wcf Service App:

IUserService.cs

C#
using System;

namespace kloudServices
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IUserService" in both code and config file together.
    [ServiceContract]
    public interface IUserService
    {
        
        [OperationContract]
        [WebInvoke(UriTemplate = "GetXml", Method = "POST", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)]
        GetUserResponse Get(GetUserRequest Getuserrequest);
        
    }
}


UserService.cs

C#
<pre lang="xml">using System;

namespace KloudServices
{
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    public class UserService
    {

       
        public GetUserResponse Get(GetUserRequest Getuserrequest)
        {
            GetUserResponse Getuserresponse = new GetUserResponse();

            try
            {
                Getuserresponse = UserBLL.Get(Getuserrequest);
            }
            catch (BaseException ex)
            {
                throw new FaultException(ex.Summary);
            }

            return Getuserresponse;
        }
      
      
    }
}




Please help me... how can i add service reference to my .net project

Thanks in advance
Posted
Updated 24-Oct-12 20:10pm
v2
Comments
Rohit Shrivastava 19-Oct-12 14:11pm    
why did you removed .svc file. .svc file will allow to configure end points. You need to have svc file to host your services in IIS. You need to also have correct configuration about the endpoint in web.config file. I would like to know what mechanism are you intended to host your WCF services.
.net333 19-Oct-12 14:16pm    
finally i solved this problem.

1 solution

I followed this Link...http://www.a2zdotnet.com/View.aspx?Id=188#.UIGQnu8tvIU[^]

In service hosting environment i added ServiceActivation Attribute like this

XML
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
            <serviceActivations>
                <add service="Service.UserService" relativeAddress="UserService.svc"/>
            </serviceActivations>
        </serviceHostingEnvironment>
 
Share this answer
 
Comments
fjdiewornncalwe 19-Oct-12 14:38pm    
Not sure why someone voted less than 5 for this. +5 for me. Thanks for sharing the solution you found. That way others can learn. Cheers.
.net333 19-Oct-12 14:46pm    
thank you so much Marcus

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900