开发者

How to make Installer using WCF

开发者 https://www.devze.com 2023-03-16 06:37 出处:网络
I have one console application.The application calls WCF on server. The applicationruns perfectly in Visual Studio 2008.

I have one console application.The application calls WCF on server. The application runs perfectly in Visual Studio 2008.

error:

How to make  Installer using WCF

How to make  Installer using WCF

I used an installer project in Visual Studio. I make an installer give primary output to the Application. It cannot connect to WCF on server.

What steps are necessary to make an installer which has an console (Application)exe, which in turn uses WCF.

My Scope Initialization starts from 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");

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


Actually you cannot directly create an installer project by adding primary output from a WCF service. You should host the WCF service inside a windows service and add the primary output of the windows service to the installer project.

  1. create a WCF.

  2. create a windows service and host the WCF inside it (call the WCF from windows service).

  3. Create a setup project (installer project).

  4. Add the primary output of the windows service to the installer project.

see this link to see the hosting details...

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

See this blog. It will help you with the implementation of windows service...

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号