创建IIS站点的问题。 ( 积分: 100 )

  • 主题发起人 主题发起人 冰女孩
  • 开始时间 开始时间

冰女孩

Unregistered / Unconfirmed
GUEST, unregistred user!
请问用什么软件比较好做呢,能否提供这方面的帮助。谢谢!
 
请问用什么软件比较好做呢,能否提供这方面的帮助。谢谢!
 
既然是IIS站点,当然只有用M$的IIS了-_-#
2K,XP,2003SERVER都有,在安装WINDOWS组件里,配置也容易,但2K专业版,XP专业版的IIS不太稳定
 
unit p_iis;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, StdCtrls, p_tabenter;

type
TFRM_IIS = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
EDCOMMENT: TEdit;
EDIPADDRESS: TEdit;
EDCOMMENTPATH: TEdit;
EDWEBNUM: TEdit;
Button1: TButton;
Button2: TButton;
cbstartiis: TCheckBox;
edport: TEdit;
Label5: TLabel;
kEnterAsTab1: TkEnterAsTab;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);
private
{ Private declarations }
function CheckInput: Boolean;
function ConfigWebServer: Boolean;
function ConfigWebVirtualCGIBIN: Boolean;
public
{ Public declarations }
end;
function ADsGetObject(const PathName: WideString; const GUID:
TGUID; out I: IUnknown): HRESULT; stdcall;

var
FRM_IIS: TFRM_IIS;

implementation

uses ActiveDs_TLB, IISExt_TLB, p_setupdata;

{$R *.dfm}

function ADsGetObject; external 'activeds.dll' name 'ADsGetObject';
//创建IIS站点
function Tfrm_iis.ConfigWebServer: Boolean;
var
I: IADsContainer;
ADs: IADs;
ServerObj: IADs;
begin
try
try
screen.Cursor := crHourGlass;
if ADsGetObject('IIS://localhost/w3svc', IID_IADsContainer, IUnknown(I)) = S_Ok then
begin
//create a new virtual server at the service,数字2是站点号,1是默认的WEB站点,你可以改成其他的,如8,9等
ServerObj := IADs(I.Create('IIsWebServer', edwebnum.text));
//configure new server
ServerObj.Put('ServerSize', 1); // Medium-sized server
ServerObj.Put('ServerComment', edComment.text);
ServerObj.put('ServerBindings', edIPAddress.text + ':' + edPort.text + ':');
// Write info back to Metabase,80是端口号
// ServerObj.put('ServerBindings', ':80:');
ServerObj.SetInfo;
if ServerObj.QueryInterface(IID_IADsContainer, I) = S_OK then
begin
//create virtual root directory
ADs := IADs(I.Create('IIsWebVirtualDir', 'Root'));
//Configure new virtual root
ADs.put('Path', edCommentPath.Text); //站点路径
ADs.put('AccessRead', 'True'); //存取权限设置,这里是设置读权限,具体的资料你可以看MSDN
//ADs.put('AccessWrite','True');
ADs.put('AccessScript', 'True'); //设置脚本权限
ADs.put('EnableDefaultDoc', 'True'); //设置允许默认文档
//Configure Default Document as "index.asp"
ADs.put('DefaultDoc', 'default.htm'); //将默认文档设置为"index.asp",你可以设置成自己需要的
//ADs.put('EnableDirBrowsing','F');
//Write info back to Metabase
ADs.SetInfo;
(ADs as IISApp).AppCreate(true);
end;
end;
if cbStartIIS.Checked = True then //create and start the web
begin
if ADsGetObject('IIS://localhost/w3svc', IID_IADsContainer, IUnknown(I)) = S_Ok then
begin
ADs := IADs(I.GetObject('IIsWebServer', edwebnum.text));
(ADs as IADsServiceOperations).start;
end;
end;
//start the service

finally
screen.Cursor := crdefault;
end;
Result := true;
except
Result := false;
end; // try/except
end;



为什么我在编译的时候会出现“p_tabenter.dcu没有找到呢。”是没有导入什么?
 
呵呵,是的,是的,用你的话说,正是没有导入p_tabenter.dcu。你用了p_tabenter组件而没有指明其DCU的路径。在环境library里添加指向p_tabenter的DCU的路径即可。[:D]
 
p_tabenter,关键是我没有这个dcu呀。
 
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, StdCtrls, p_tabenter; //你没有最后这个,那最后这个是谁替你写上去的?[:D]没有就满硬盘找;问项目负责人要;难道用这个p_tabenter不是你的主意?如果是别人的,问那人要。活人能憋死啊?[^]
 

Similar threads

回复
0
查看
862
不得闲
D
回复
0
查看
867
DelphiTeacher的专栏
D
D
回复
0
查看
836
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部