Hello HailStorm !

** Hello HailStorm ! **


小气的神 2002-02-20

Article Type: OverView

难度等级: 2/9

版本: 1.26

HailStorm 现在被 Microsoft 命名为 ** .NET My Services ** ** , ** 不过我喜欢用 HailStorm 这个名字,目前它还没有公布 Beta 版本,正在进行 M1 阶段的开发,估计今年( 2002 )的年中会 Finally Released 。不知道会是 Beta 还是 RC 的版本会真正发布,外界认为会是整个功能的一半功能,也就是 M1 的部分。另一方面 HailStorm 还需要一些外部的条件,比如目前 Passport 的下一个版本,新的 Windows.NET OS 系列,实现一些有关安全和事务的公共协议等等。

下面的记录是基于 2001.10.22 日的 HailStorm SDK ,最少运行在 PDC 版本的 Visual Studio .NET 上,也就是 RC1 之后的版本上, RTM 也是 OK 的。现在一些网站包括微软网站已经可以下载得到这个 SDK 。这一次我们的主题是从安装这个 SDK 起步认识 Hailstorm 。不过事情的发展并非一帆风顺,这种戏剧性的变化在之后的很多日子被我认为是如此的苦涩和充满“中国特色”。

当然安装一个软件不会让任何人太记忆深刻,安装前我细细阅读了几遍安装文档,当然事后我承认也许有疏漏的地方,因为我当时的焦点在于将 Visual Studio 从 Beta2 升级到 RC3 上。下面这些是安装时要特别注意的:

1. OS 必须是 W2K+SP2 或 XP RC1+

2. IIS 和 服务扩展必须安装,并且运行 OK 。

3. SQL 2000 + SP1+ 并且 SDK Setup 程序不接受空的数据库密码

4. Microsoft SOAP Toolkit 2.0 + SP1+ 并且自带的 Sample 可以运行。

5. Windows Scripting Host(WSH) 5.5+, IE 5.5 SP1+

6. Microsoft Visual Studio.NET RC1+

安装过程很顺利(建议这些都安装在一台机器上, SQL 使用 sa 用户)。

SDK 安装完成之后,如果你已安装了 VS.NET 那么你可以继续安装 SDK for VS.NET ,当然这是我当时最感兴趣的,同样安装也很顺利。

成功后桌面上会有两个 Sample 的快捷键。一个是控制台的 Sample ,一个是 GUI 的 Sample ,按照文档说明,根据文档描述如果一切顺利,你可以正确的运行这些 Sample , 控制台方式的将连续弹三个消息框然后退出;而 GUI 的将可以象 IE 一样浏览网页并且收集 Favorites 。看得出两个 Sample 都是用 13 个 Services 中的 .NET FavoriteWebSites Services 。可是我运行的结果不是连续三个消息框,而是一个致命的对话框。

当然第一个反应是安装有问题,但是安装程序并未报告任何错误。我又到另外的一台机器上安装,结果同样,在网络上寻找有关 HailStorm 的同时,我才发现有关这方面的文章资料很少,中文的就更少了。但是 codeProject 和 O'REILLY Network 的 Diana Mitra 和 Jones 分别都撰文讨论了自己用 Managed C++ 和 Python 与 HailStorm SDK 交互的情况,虽然这些文章都没有描述我遇到的情况,但使得我可以学习有关 HailStorm 的一些知识,特别是 Jones 用 Python 的 ** 文章 ** 让我对 HailStorm 的工作原理有了更多的认识。我找到了 SDK 中的 hspost.exe ,这是一个很原始的工具,可以用它执行 HSDL ( .NET My Services Data-Manipulation Language )指令来交互获得结果。终于有一天当我执行下面的指令:

C:\Microsoft .NET My Services SDK\Bin>hspost –d content -f insertRequest.xml -o ccBoy -s myServices

 1<s:envelope xmlns:hs="http://schemas.microsoft.com/hs/2001/10/core" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
 2<s:header>
 3<path xmlns="http://schemas.xmlsoap.org/rp/">
 4<action>http://schemas.microsoft.com/hs/2001/10/core#fault</action>
 5<rev></rev>
 6<from>http://VSDOTNET</from>
 7<id>72D64FD0-1BD6-11D6-A744-00B0D0E302B3</id>
 8<relatesto>72D4C8A0-1BD6-11D6-A744-00B0D0E302B3</relatesto>
 9</path>
10<hs:response>
11</hs:response>
12</s:header>
13<s:body>
14<s:fault>
15<s:faultcode>Client</s:faultcode>
16<s:faultstring>Illegal operation</s:faultstring>
17<s:detail xmlns="http://schemas.microsoft.com/hs/2001/10/core">
18<faultresponseaction>Correct</faultresponseaction>
19<faultchain>
20<fault>
21<code>0x70008</code>
22<shortdescription>Illegal operation</shortdescription>
23
24** <longdescription> **
25
26An unexpected error has occurred. SQL message: 'RAISERROR  无法在  sysmessages  中找到错误  76004  所对应的条目。  '. SQL error code: 2758. Check the request. 
27
28** </longdescription> **
29
30</fault>
31</faultchain>
32</s:detail>
33</s:fault>
34</s:body>
35</s:envelope>

仍然还有错误出现,可是我们可以下这样的结论:程序确实运行了,但是和数据库交互的部分发生了错误。我想了一阵才反应到可能是 SQL 自定义错误的问题了,因为 76004 不是 SQL Server 中定义的。然后在安装程序的 hsadmin.sql 中发现这样的 SQL 语句:

EXEC sp_addmessage @msgnum = 76002, @severity = 10,

@msgtext = N'%08x [XDB] Select count _.',

@replace = 'REPLACE'

EXEC sp_addmessage @msgnum = 76003, @severity = 10,

@msgtext = N'%08x%08x [XDB] New change number __.',

@replace = 'REPLACE'

EXEC sp_addmessage @msgnum = 76004, @severity = 10,

@msgtext = N'%08x [XDB] Begin InternalOpId _.',

@replace = 'REPLACE'


有经验的人已经知道问题出在那里了。上述的语句在中文简体的 SQL Server 中是会出错的。之后我试图手工的将这十几个 msgnum 手工的加入到我的 SQL Server 中,结果似乎没有打个补丁这么简单。最后的解决办法是 Uninstall 我的中文版 SQL Server ,然后安装英文版本。之后我们可以获得下面正确的结果了

C:\Microsoft .NET My Services SDK\Bin>hspost –d content -f insertRequest.xml -o ccBoy -s myServices

 1<s:envelope xmlns:hs="http://schemas.microsoft.com/hs/2001/10/core" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
 2<s:header>
 3<path xmlns="http://schemas.xmlsoap.org/rp/">
 4<action>http://schemas.microsoft.com/hs/2001/10/core#response</action>
 5<rev></rev>
 6<from>http://localhost</from>
 7<id>4E1CD820-1C70-11D6-A749-00B0D0E302B3</id>
 8<relatesto>4E184290-1C70-11D6-A749-00B0D0E302B3</relatesto>
 9</path>
10<hs:response>
11</hs:response>
12</s:header>
13<s:body>
14<hs:insertresponse newchangenumber="351" selectednodecount="1" status="success" xmlns:hs="http://schemas.microsoft.com/hs/2001/10/core"></hs:insertresponse>
15</s:body>
16</s:envelope>

结论是:对于这个版本的 SDK ,最好和保险的建议是安装英文版本的 SQL 2000. 同时这也是我花了很多时间获得的教训。建议你安装之后可以试一下上面的命令,保证安装真正的成功。

insertRequest.xml 是下面内容的一个简单 xml 文档

1<hs:insertrequest select="/" xmlns="http://schemas.microsoft.com/hs/2001/10/myFavoriteWebSites" xmlns:hs="http://schemas.microsoft.com/hs/2001/10/core">
2<favoritewebsite>
3<title xml:lang="en">Hello. HailStorm</title>
4<url>http://www.microsoft.com</url>
5</favoritewebsite>
6</hs:insertrequest>

如果我们不是过于迷恋 IDE ,那么从手工方式中我们也许可以获得更多的知识和体验,有时候最简单的方式往往使我们更容易接触到事物的本质,最后发现错误的原因。

还有一个常见的错误,我也贴出来,也许对你会有帮助:

C:\Microsoft .NET My Services SDK\Bin>hsprov -s myProfile -l http://vsdotnet -o ccBoy

Error 0x00000012 submitting initial query to myServices

The error 12 is a very generic error which means that the server is not reachable and could happen due to a variety of reasons.

Here is a list of known issues that could cause error 12

1. SQL server has a blank password for the administrator, while installing SQL server select the defaults.

2. Do not try to provision myServices but any one of the other services.

3. During Installation of .Net My Services make sure you select the windows authentication to access the SQL server. or give a non blank password.

4. If all the above are the steps that you have taken already make sure that you can reach the www service using http://machinename/myService this should throw up a authentication dialog box.

上面信息来源 Microsoft 新闻组。

建议你仔细的阅读 SDK 中的安装文档, Microsoft <SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-


Published At
Categories with Web编程
Tagged with
comments powered by Disqus