繁体   English   中英

如何使用 WCF 制作安装程序

[英]How to make Installer using WCF

我有一个控制台应用程序。该应用程序在服务器上调用 WCF。 该应用程序在 Visual Studio 2008 中完美运行。

错误: 在此处输入图像描述

在此处输入图像描述

我在 Visual Studio 中使用了一个安装程序项目。 我让安装程序将主要 output 提供给应用程序。 它无法连接到服务器上的 WCF。

制作具有控制台(应用程序)exe 的安装程序需要哪些步骤,该程序又使用 WCF。

我的 Scope 初始化从 initScopeInfo 开始。

   private void initScopeInfo()
       {
        DBSyncProxy.SqlSyncProviderProxy client = null;            
        ScopeConfigHandler scopeHandler = null;
        try
        {

    //Providing the Config file name('db_config_new.xml') stored in static variable.    
            DBSyncXMLUtil.setXPathDocument(DBSyncConstants.DB_SYNC_CONFIG_FILE_NAME);

            //DBSyncXMLUtil.setXPathDocument(filepath);
            string endpoint = DBSyncXMLUtil.getSystemParameter(DBSyncXMLUtil.getDocumnetRoot(), "ServiceURL");

在 setXpathDocument 中

     public static void setXPathDocument(string uri)
      {
public static XPathDocument doc = null;

        doc = new XPathDocument(uri);
    }
     public static string getSystemParameter(XPathNavigator docroot, string key)
    {
        string value = null;
        try
        {
            string xpath = DBSyncConstants.XPATH_SYSTEM_PARAMETER;
            xpath += "[@key='" + key + "']";

            Console.WriteLine("DBSyncXMLUtil :: getParameter() :: XPATH =="+xpath);

    Probably  Error on below mentioned line

            XPathNavigator node = getDocumnetRoot(doc).SelectSingleNode(xpath);
            if (node != null)
                value = node.Value;
            else
                Console.WriteLine("Invalid XPATH");
        }
        catch (Exception ex)
        {
            Console.WriteLine("DBSyncXMLUtil :: getSystemParameter() :: Exception ==" + ex.ToString());
        }
        return value;
    }

实际上,您不能通过从 WCF 服务添加主 output 来直接创建安装程序项目 应该在 windows 服务内托管 WCF 服务,并将 Z0F4137ED1502B8B504C2 项目安装程序的主 output 添加到服务output 到服务ZZ22 项目安装程序。

  1. 创建一个 WCF。

  2. 创建一个 windows 服务并在其中托管 WCF(从 Z0F4137ED1502B5045D608 服务调用 WCF)。

  3. 创建一个安装项目(安装程序项目)。

  4. 将 windows 服务的主 output 添加到安装程序项目。

查看此链接以查看托管详细信息...

http://msdn.microsoft.com/en-us/library/ms733069.aspx

看到这个博客。 它将帮助您实现 windows 服务...

http://joefreeman.co.uk/blog/2010/03/creating-a-setup-project-for-a-windows-wcf-service-with-visual-studio/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM