带有.svc文件的wcf服务

问题描述:

朋友,
我将wcf服务应用程序添加到了解决方案中...我删除了.svc文件并添加了UserService.cs和IUserService.cs类..如果运行解决方案我没有得到终点...我想将UserServiceReference添加到.net项目中

这是我的wcf服务应用程序:

IUserService.cs

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

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



UserService.cs

<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;
        }
      
      
    }
}





请帮助我...我该如何向我的.net项目添加服务引用

在此先感谢





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

Thanks in advance

我关注了此链接... ^ ]

在服务托管环境中,我添加了这样的ServiceActivation属性

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

In service hosting environment i added ServiceActivation Attribute like this

<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
            <serviceActivations>
                <add service="Service.UserService" relativeAddress="UserService.svc"/>
            </serviceActivations>
        </serviceHostingEnvironment>