带有.svc文件的wcf服务 [英] wcf service with out .svc file

查看:190
本文介绍了带有.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

推荐答案

我关注了此链接...
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>


这篇关于带有.svc文件的wcf服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆