项目中用到WebOrb的Real-time messaging,考虑到rtmp协议需要配置服务器防火墙打开2037端口,最终选择rtmpt协议。配置中遇到一些麻烦,主要是iis7还是不熟悉,经过一番周折还是搞定了。以下是WebOrb官方的配置指导:
http://www.themidnightcoders.com/fileadmin/docs/dotnet/guide/index.htm
WebORB provides support for RTMPT thus enabling communication between real-time messaging clients and server applications, streams and remote shared objects over port 80. There are special configuration requirements for RTMPT:
Follow the steps described below to configure IIS and WebORB to process RTMPT requests:
Click the Configuration button in the Application Settings section of the Home Directory tab. Click "Insert..." to add a wildcard application map and enter the full path to aspnet_isapi.dll for your .NET installation. (path in our testing environment is c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll). Make sure to uncheck the "Verify that file exists" checkbox. Click OK to accept the values. |
Copy weborb.config into the website root folder.
IIS7中的设置
选择"Handler Mappings" -> "Add Wildcard Script Map..."
Choose aspnet_isapi.dll as an executable and give this script mapping some meaningful name, such as ASP.NET-ISAPI-2.0-Wildcard. After that click OK and then click Yes in the "Add Wildcard Script Map" dialog.
Next, switch to the ordered list view for the handler mappings by clicking on "View Ordered List..." action and move the newly created mapping to the bottom of the list just before the StaticFile handler mapping:
最关键的一点,对应官方给的II6中配置第五步,添加相应的托管HttpHandler(IIS7的Handler Mappings右侧 Add Managed Handler...)
根据官方第5步Register WebORB RTMPT handler.填写相应的请求路径
全部加好后:
比较一下IIS6和IIS7的Web.config不同之处
IIS6:
<system.web>
<httpHandlers>
<add verb="*" path="/open/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" />
<add verb="*" path="/send/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" />
<add verb="*" path="/idle/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" />
<add verb="*" path="/close/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" />
<add verb="*" path="/open/*/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" />
<add verb="*" path="/send/*/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" />
<add verb="*" path="/idle/*/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" />
<add verb="*" path="/close/*/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" />
<add verb="*" path="weborb.aspx" type="Weborb.ORBHttpHandler" />
<add verb="*" path="codegen.aspx" type="Weborb.Management.CodeGen.CodegeneratorHttpHandler" />
</httpHandlers>
...
</system.web>
IIS7:(注意IIS7中会使用最下面的 <system.webServer>节点)
<system.webServer>
<handlers>
<add name="rtmptHttpHandler1" verb="*" path="/open/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" resourceType="Unspecified" preCondition="integratedMode"/>
<add name="rtmptHttpHandler2" verb="*" path="/send/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" resourceType="Unspecified" preCondition="integratedMode"/>
<add name="rtmptHttpHandler3" verb="*" path="/idle/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" resourceType="Unspecified" preCondition="integratedMode"/>
<add name="rtmptHttpHandler4" verb="*" path="/close/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" resourceType="Unspecified" preCondition="integratedMode"/>
<add name="rtmptHttpHandler5" verb="*" path="/open/*/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" resourceType="Unspecified" preCondition="integratedMode"/>
<add name="rtmptHttpHandler6" verb="*" path="/send/*/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" resourceType="Unspecified" preCondition="integratedMode"/>
<add name="rtmptHttpHandler7" verb="*" path="/idle/*/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" resourceType="Unspecified" preCondition="integratedMode"/>
<add name="rtmptHttpHandler8" verb="*" path="/close/*/*" type="Weborb.Messaging.Net.RTMPT.RTMPTHttpHandler" resourceType="Unspecified" preCondition="integratedMode"/>
<add name="codegen.aspx_*" path="codegen.aspx" verb="*" type="Weborb.Management.CodeGen.CodegeneratorHttpHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="weborb.aspx_*" path="weborb.aspx" verb="*" type="Weborb.ORBHttpHandler" preCondition="integratedMode,runtimeVersionv2.0" />
</handlers>
...
</system.webServer>
另外,值得一提的是flex代码中的NetConnection实例的uri要做相应修改
例如
原:"rtmp://192.168.1.123:2037/Chat/"
修改后::"rtmpt://192.168.1.123/Chat/"