Compartir a través de


Starting Your New On-Demand Publishing Point

After everything has been configured, you are ready to begin publishing your content. To start your new on-demand publishing point, all you need to do is be sure that it is waiting for client connections. The following examples show you how to be sure that your new publishing point is ready to accept client connections.

Visual Basic .NET Example

Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices

' Declare variables.
Dim Server As WMSServer
Dim ODPubPoint As IWMSOnDemandPublishingPoint

Try
    ' Create the WMSServer object.
    Server = New WMSServer()

    ' Retrieve an on-demand publishing point.
    ODPubPoint = Server.PublishingPoints.Item("NewPubPointII")

    ' To enable an on-demand publishing point,
    ' simply allow client connections.
    ODPubPoint.AllowClientsToConnect = True

Catch errCom As COMException
    ' TODO: Handle COM exceptions.
Catch err As Exception
    ' TODO: Exception handler goes here.
Finally
    ' TODO: Clean-up code goes here.
End Try

C# Example

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer Server;
IWMSOnDemandPublishingPoint ODPubPoint;

try 
{
    // Create the WMSServer object.
    Server = new WMSServerClass();

    // Retrieve an on-demand publishing point.
    ODPubPoint = 
(IWMSOnDemandPublishingPoint)Server.PublishingPoints["NewPubPointII"];

    // To enable an on-demand publishing point,
    // simply allow client connections.
    ODPubPoint.AllowClientsToConnect = true;
}
catch (COMException comExc)
{
    // TODO: Handle COM exceptions.
}
catch (Exception exc) 
{
    // TODO: Handle exceptions.
}
finally 
{
    // Clean-up code goes here.
}

C++ Example

#include <windows.h>
#include <atlbase.h>    // Includes CComBSTR.
#include "wmsserver.h"

// Declare variables and interfaces.
IWMSServer                  *pServer;
IWMSPublishingPoints        *pPubPoints;
IWMSPublishingPoint         *pPubPoint;
IWMSOnDemandPublishingPoint *pODPubPoint;

HRESULT         hr;
CComVariant     varName;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
                      NULL,
                      CLSCTX_ALL,
                      IID_IWMSServer,
                      (void **)&pServer);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the IWMSPublishingPoints interface.
hr = pServer->get_PublishingPoints(&pPubPoints);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to a publishing point.
varName = L"NewPubPointII";
hr = pPubPoints->get_Item(varName, &pPubPoint);

// Query the IWMSOnDemandPublishingPoint interface from
// the publishing point.
hr = pPubPoint->QueryInterface(IID_IWMSOnDemandPublishingPoint,
                              (void **)&pODPubPoint);

// To enable an on-demand publishing point,
// simply allow client connections.
hr = pODPubPoint->put_AllowClientsToConnect(VARIANT_TRUE);
if (FAILED(hr)) goto EXIT;

EXIT:
    // TODO: Release temporary COM objects and uninitialize COM.

See Also

Reference

IWMSOnDemandPublishingPoint Interface

IWMSOnDemandPublishingPoint Object (C#)

IWMSOnDemandPublishingPoint Object (Visual Basic .NET)

Concepts

Publishing Content On Demand