/// <summary>
/// Creates an instance of the COM server.
/// </summary>
public void CreateInstance()
{
// multiple calls are not allowed - may block for a while due to network operation.
lock (m_lock)
{
ServerFactory factory = new ServerFactory();
try
{
// create the server.
Unknown = factory.CreateServer(new Uri(m_url), null);
// set the locale.
SetLocale(LocaleId);
if (UserIdentity != null)
{
SetUserIdentity(UserIdentity);
}
// do any post-connect processing.
OnConnected();
}
catch (Exception e)
{
ComUtils.TraceComError(e, "Could not connect to server ({0}).", m_url);
// cleanup on error.
Close();
}
finally
{
factory.Dispose();
}
}
}