wince6.0下web开发 【转】
大多数人可能用不到wince的这个功能,事实它的这个功能也非常的有用,但是对于不知道的人来说,想入门还是很难的,简单的添加web服务器比较简单,让我一步步的讲给各位吧,供Wince的爱好者共同学习,这篇文章共分四部分,其中第二部分讲述的ISAPI的实现方式,最重要的是第三、第四部分的内容,以和大家共享之。如果那位要用这篇文章,请注明出处:
第一步:添加web server到NK
CoreOS-CEBASE -Windows CE devices-Communication Services and Networking-Servers-Web Server,如果需要ASP,加上JScript或者VBScript,以及ISAPI,如图所示:
第二步:生成相应的dll文件
$(_WINCEROOT)\PUBLIC\SERVERS\SDK\SAMPLES\HTTP\FILTERS
在这里我用上述文件夹下的文件来作演示:
这个文件夹有一个readme.txt文件夹告诉你怎么去生成dll文件,我引用如下:
1) Build an image with the Windows CE Web Server included.
2) Build the tracker sample DLL. To do this, open a build window (which can be
done in Platform Builder via "Build->Open Build Release Directory")
and change directory to %_WINCEROOT%\public\servers\sdk\samples\http\filters.
Then type build. This will create a DLL named tracker.dll. Put it in your
image in \windows\tracker.dll.
3) Setup the Web Server to load the tracker ISAPI filter DLL with the following
registry settings:
[HKEY_LOCAL_MACHINE\COMM\HTTPD]
"Filter DLLs"="\windows\tracker.dll" (REG_SZ type)
4) Setup a virtual root so that the tracker DLL can be viewed as an ISAPI DLL
[HKEY_LOCAL_MACHINE\COMM\HTTPD\VROOTS\/Tracker]
@="\windows" (REG_SZ type. "@" means "default" registry value in this context)
5) Load the CE image. The web server will automatically be started. Visit
the web server with a browser. The tracker ISAPI filter will be recording
each request.
6) To view the tracker information,
visit http://{CEMachineName}/tracker/tracker.dll?View
但当运行build的时候会生成如下,没有生成dll
D:\WINCE600\PUBLIC\SERVERS\SDK\SAMPLES\HTTP\FILTERS>build
Build for Windows CE (Release 601) (Built on Aug 17 2006 15:18:52)
File names: Build.log Build.wrn Build.err Build.dat
BUILD: [Thrd:Sequence:Type ] Message
BUILD: [00:0000000000:PROGC ] Build started with parameters:
BUILD: [00:0000000001:PROGC ] Build started in directory: D:\WINCE600\PUBLIC\S
VERS\SDK\SAMPLES\HTTP\FILTERS
BUILD: [00:0000000002:PROGC ] Checking for d:\WINCE600\sdk\bin\i386\srccheck.e
.
BUILD: [00:0000000003:PROGC ] Running passes WCEFILES0, MIDL, MC, ASN, THUNK,
ECOMPHEADER, COMPILE, LIB, LINK, MANAGEDRESX, MANAGEDMOD, MANAGEDDLL, MANAGEDE
, MANAGEDWIN for ARM.
BUILD: [00:0000000004:PROGC ] Loading database "D:\WINCE600\PUBLIC\SERVERS\Bui
.dat".
BUILD: [00:0000000005:PROGC ] Done.
BUILD: [00:0000000006:PROGC ] Computing include file dependencies:
BUILD: [00:0000000007:PROGC ] Checking for SDK include directory: d:\WINCE600\
k\CE\inc.
BUILD: [00:0000000008:PROGC ] Scan D:\WINCE600\PUBLIC\SERVERS\SDK\SAMPLES\HTTP
ILTERS\
BUILD: [00:0000000009:WARNS ] Directory: D:\WINCE600\PUBLIC\SERVERS\SDK\SAMPLE
inc\ does not exist.
BUILD: [00:0000000010:PROGC ] Building WCEFILES0 Pass in D:\WINCE600\PUBLIC\SE
ERS\SDK\SAMPLES\HTTP\FILTERS\ directory.
BUILD: [00:0000000022:PROGC ] Saving D:\WINCE600\PUBLIC\SERVERS\Build.dat.
BUILD: [00:0000000024:PROGC ] Done.
BUILD: [00:0000000025:PROGC ] Files Warnings Errors
BUILD: [00:0000000026:PROGC ] Midl 0 0 0
BUILD: [00:0000000027:PROGC ] Message 0 0 0
BUILD: [00:0000000028:PROGC ] Precomp Header 0 0 0
BUILD: [00:0000000029:PROGC ] Resource 0 0 0
BUILD: [00:0000000030:PROGC ] MASM 0 0 0
BUILD: [00:0000000031:PROGC ] SHASM 0 0 0
BUILD: [00:0000000032:PROGC ] ARMASM 0 0 0
BUILD: [00:0000000033:PROGC ] MIPSASM 0 0 0
BUILD: [00:0000000034:PROGC ] C++ 0 0 0
BUILD: [00:0000000035:PROGC ] C 0 0 0
BUILD: [00:0000000036:PROGC ] Static Libraries 0 0 0
BUILD: [00:0000000037:PROGC ] Exe's 0 0 0
BUILD: [00:0000000038:PROGC ] Dll's 0 0 0
BUILD: [00:0000000039:PROGC ] Preprocess deffile 0 0 0
BUILD: [00:0000000040:PROGC ] Resx 0 0 0
BUILD: [00:0000000041:PROGC ] CSharp Compile 0 0 0
BUILD: [00:0000000042:PROGC ] Other 0 1 0
BUILD: [00:0000000043:PROGC ]
BUILD: [00:0000000044:PROGC ] Total 0 1 0
BUILD: [00:0000000045:PROGC ]
BUILD: [00:0000000046:PROGC ] 1 Warnings, 0 Errors
BUILD: [00:0000000047:PROGC ] GetSystemTimes (seconds): Idle: 0 Kernel: 0
User: 0
BUILD: [00:0000000048:PROGC ] Elapsed time (seconds): 0
原因是文件夹下的sources这一句有问题:
INCLUDES=..\..\inc
应该改为:INCLUDES=..\..\..\inc,重新build,即可生成tracker.dll,存放在文件夹:$(_WINCEROOT)\PUBLIC\SERVERS\OAK\target\ARMV4I\retail
第三步:copy trakcer.dll到相应的release目录
第四步:按照上述readme修改server.reg如下:
....
[HKEY_LOCAL_MACHINE\COMM\HTTPD\]
"Filter DLLs"="\\windows\\tracker.dll"
"MaxLogSize"=dword:8000
"LogFileDirectory"="\\windows\\www"
"NTLM"=dword:1
"Basic"=dword:0
; Many configuration web pages (and telnet/ftp servers) by convention use a
; user named ADMIN to have admin level priveleges. Make sure this special ADMIN user
; has admin-level access to all Virtual Roots in web server as well, for convenience.
"AdminUsers"="ADMIN"
[HKEY_LOCAL_MACHINE\COMM\HTTPD\VROOTS\/]
@="\\windows\\www\\wwwpub\"
"a"=dword:0
[HKEY_LOCAL_MACHINE\COMM\HTTPD\VROOTS\/Tracker]
@="\\windows"
.....
第五步:修改platform.bib,添加下列命令
tracker.dll $(_FLATRELEASEDIR)\tracker.dll NK H
第六步:运行Make Run-time image命令
第七步:烧录新Nk后,启动。在IE中显示如下画面!!大功告成。
输入
http://127.0.0.1/tracker/tracker.dll?view
可看到效果
附件上传了tracker.dll、platform.bib、servers.reg和tracker源文件