how to remote connect to isa server 2000?
来源:互联网 发布:淘宝免费课程视频 编辑:程序博客网 时间:2024/05/16 05:09
Bonjour,
TSw avait énoncé :
Quote:Is there any way to bind to msfpccom (FPCDS.Root) on remote machine from c#?
On localhost Marshal.BindToMoniker("new:FPC.Root") works ok, but I was not
able to figure out how to connect to remote machine...
Someone on this forum give me tips to connect the fcp.root on a remote
machine.
Based on his code, this is how I've got it to work with VC++ 6.0 (an
VC++5.0) :
(It's part of a "work in progess" program to manage blacklists on ISA)
m_local is BOOL mapped to check box wether I'm on the ISA or on remote
machine
m_Server is a CString mapped to EditBox that contains the name of the
ISA server
The remote machine should have the ISA management tools installed, in
order to have the good entries in the register
-------------------------------------------------------
//some declarations
#include <objbase.h>
#include <atlconv.h>
#define _WIN32_WINNT 0x0400
#define UNICODE
#define INITGUID
#import "c:/program files/microsoft ISA Server/MSFPCCOM.DLL"
using namespace FPCLib;
..../...
BOOL Connected = false;
WCHAR psz[100];
HRESULT hr;
COSERVERINFO info;
MULTI_QI qis;
IFPC* pUnk = NULL;
BOOL ResultFound=false;
IFPCPtr fpcRoot;
IFPCArraysPtr fpcArrays;
IFPCArrayPtr fpcArray;
IFPCServersPtr fpcServers;
IFPCServerPtr fpcServer;
IFPCEnterprisePtr fpcEnterprise;
IFPCDestinationSetsPtr fpcDestinationSets;
IFPCDestinationSetPtr fpcDestinationSet;
IFPCDestinationPtr fpcDestination;
..../...
//Here is the connection part
void CMyDialogDlg::OnConnect()
{
// TODO: Add your control notification handler code here
USES_CONVERSION;
BeginWaitCursor();
if ( !Connected ) {
hr = CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
if (SUCCEEDED(hr)) {
wcscpy(psz,T2W((LPCTSTR)m_Server));
memset(&info, 0, sizeof(info));
info.pwszName = psz;
const IID IIDFPC = __uuidof(FPC);
const IID iid = __uuidof(IFPC);
qis.hr = 0;
qis.pIID = &iid;
qis.pItf = NULL;
////////// Using CreateInstance or CoCreateInstanceEx according to
m_Local
try {
if (!m_Local) {
CoCreateInstanceEx(IIDFPC, NULL, CLSCTX_REMOTE_SERVER, &info, 1,
&qis);
pUnk = (IFPC*)qis.pItf;
hr = qis.hr;
}else{
hr = fpcRoot.CreateInstance("FPC.Root");
}
if (FAILED (hr)){ MessageBox("Failed to connect to the specified
server") ; CoUninitialize() ; goto exit; }
if (!m_Local) fpcRoot.Attach(pUnk, true);
//At this point the fpcRoot should be a pointer on ISA COM Object
// and all functions should work
hr = fpcRoot->Refresh();
if (SUCCEEDED(hr)){
Connected = true;
FpcArrayType Type;
char ServerType[3][20] = { "Standard Edition","Stand
Alone","Array"};
hr = fpcRoot->get_Type(&Type);
fpcArrays = fpcRoot->Arrays;
short j=1;
fpcArray=fpcArrays->Item (_variant_t( j) );
fpcDestinationSets=fpcArray->PolicyElements->DestinationSets;
..../...
--------------------------
Hope it helps...
--
Alni
TSw avait énoncé :
Quote:Is there any way to bind to msfpccom (FPCDS.Root) on remote machine from c#?
On localhost Marshal.BindToMoniker("new:FPC.Root") works ok, but I was not
able to figure out how to connect to remote machine...
Someone on this forum give me tips to connect the fcp.root on a remote
machine.
Based on his code, this is how I've got it to work with VC++ 6.0 (an
VC++5.0) :
(It's part of a "work in progess" program to manage blacklists on ISA)
m_local is BOOL mapped to check box wether I'm on the ISA or on remote
machine
m_Server is a CString mapped to EditBox that contains the name of the
ISA server
The remote machine should have the ISA management tools installed, in
order to have the good entries in the register
-------------------------------------------------------
//some declarations
#include <objbase.h>
#include <atlconv.h>
#define _WIN32_WINNT 0x0400
#define UNICODE
#define INITGUID
#import "c:/program files/microsoft ISA Server/MSFPCCOM.DLL"
using namespace FPCLib;
..../...
BOOL Connected = false;
WCHAR psz[100];
HRESULT hr;
COSERVERINFO info;
MULTI_QI qis;
IFPC* pUnk = NULL;
BOOL ResultFound=false;
IFPCPtr fpcRoot;
IFPCArraysPtr fpcArrays;
IFPCArrayPtr fpcArray;
IFPCServersPtr fpcServers;
IFPCServerPtr fpcServer;
IFPCEnterprisePtr fpcEnterprise;
IFPCDestinationSetsPtr fpcDestinationSets;
IFPCDestinationSetPtr fpcDestinationSet;
IFPCDestinationPtr fpcDestination;
..../...
//Here is the connection part
void CMyDialogDlg::OnConnect()
{
// TODO: Add your control notification handler code here
USES_CONVERSION;
BeginWaitCursor();
if ( !Connected ) {
hr = CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
if (SUCCEEDED(hr)) {
wcscpy(psz,T2W((LPCTSTR)m_Server));
memset(&info, 0, sizeof(info));
info.pwszName = psz;
const IID IIDFPC = __uuidof(FPC);
const IID iid = __uuidof(IFPC);
qis.hr = 0;
qis.pIID = &iid;
qis.pItf = NULL;
////////// Using CreateInstance or CoCreateInstanceEx according to
m_Local
try {
if (!m_Local) {
CoCreateInstanceEx(IIDFPC, NULL, CLSCTX_REMOTE_SERVER, &info, 1,
&qis);
pUnk = (IFPC*)qis.pItf;
hr = qis.hr;
}else{
hr = fpcRoot.CreateInstance("FPC.Root");
}
if (FAILED (hr)){ MessageBox("Failed to connect to the specified
server") ; CoUninitialize() ; goto exit; }
if (!m_Local) fpcRoot.Attach(pUnk, true);
//At this point the fpcRoot should be a pointer on ISA COM Object
// and all functions should work
hr = fpcRoot->Refresh();
if (SUCCEEDED(hr)){
Connected = true;
FpcArrayType Type;
char ServerType[3][20] = { "Standard Edition","Stand
Alone","Array"};
hr = fpcRoot->get_Type(&Type);
fpcArrays = fpcRoot->Arrays;
short j=1;
fpcArray=fpcArrays->Item (_variant_t( j) );
fpcDestinationSets=fpcArray->PolicyElements->DestinationSets;
..../...
--------------------------
Hope it helps...
--
Alni
- how to remote connect to isa server 2000?
- How to Allow MySQL Client to Connect to Remote MySQL server
- How use the Ubutu to remote connect to Windows
- Unable to connect to the remote server 问题
- How to configure SQL Server 2005 to allow remote connections
- How to configure SQL Server 2005 to allow remote connections
- 访问远程Redis服务。Connect to Remote Redis Server
- 10019---访问远程Redis服务。Connect to Remote Redis Server
- Can't connect to remote MySQL server with error 61
- 访问vm_cnetos 远程Redis服务。Connect to Remote Redis Server
- ConnectionStrings.com - How to connect to SQL Server 2005
- How Do I Enable Remote Access To MySQL Database Server?
- C# How to get the system drive of remote server
- How to enable remote connections in SQL Server 2008?
- Failed to connect to remote VM
- How to access remote mysql
- How to Connect Oracle 9i with SQL Server 2000 for establishing the linked server
- How to Connect Oracle 9i with SQL Server 2000 for establishing the linked server
- 使用sharpziplib解压缩文件与文件夹
- 对身份证号码合法性的验证
- 左连接和右连接
- Stored Procedure(存储过程)编写经验和优化措施
- 1111111
- how to remote connect to isa server 2000?
- VOA特别英语节目官方词汇表汇总
- 海量数据存储过程
- Thinking in C++ 阅读笔记(第三章)
- asp.net和javascript怎样结合
- SqlDataReader 类
- 一个用来保存参数的容器类
- Jdeveloper 与 CVS集成开发
- 两条关于生成排名的SQL语句