.ashx 在 IIS7 上找不到类型错误,在 webdev 服务器上没有问题
我正在尝试使 AspNetComet.zip 在 IIS7 上工作 (一个简单的彗星聊天实现)这是我的 web.config 的一部分。
<system.web>
<httpHandlers>
<add verb="POST" path="DefaultChannel.ashx" type="Server.Channels.DefaultChannelHandler, Server"/>
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="DefaultChannelHandler" verb="POST" path="DefaultChannel.ashx" type="Server.Channels.DefaultChannelHandler, Server"/>
</handlers>
</system.webServer>
当我在本地主机 IIS7 上发布网站时,收到错误:
POST http://localhost/DefaultChannel.ashx 500 Internal Server Error
无法加载类型“Server.Channels.DefaultChannelHandler
” code>
该项目的目标框架是.Net 2.0 我尝试了.Net 2.0 的经典模式和集成模式应用程序池,但没有成功。我还尝试将项目转换为 4.0,并尝试了 .Net 4.0 的经典模式和集成模式应用程序池,但没有成功。我还尝试通过 IIS 管理器的处理程序映射添加托管处理程序。
如果您有时间,请下载源代码 (184kb) 在您自己的计算机上重现该问题。该 zip 包含 VS2010 解决方案 (.Net 2.0)。您也可以尝试将其转换为 .Net 4.0,
如果这很重要的话,我正在使用 Windows 7。如果您需要更多详细信息,请在下面留下您的评论。顺便说一下,这在我的 webdev 服务器上工作得很好。
注意:我在这里创建了这个问题的一个版本,因为我相信它比我在 SF 上发布的内容更适合(基于标签和用户群)https://serverfault.com/questions/245241/ashx-cannot-find-type -iis7-no-problems-on-webdev-server 上的错误
I am trying to make AspNetComet.zip work on IIS7
(a simple comet chat implementation) Here is a portion of my web.config.
<system.web>
<httpHandlers>
<add verb="POST" path="DefaultChannel.ashx" type="Server.Channels.DefaultChannelHandler, Server"/>
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="DefaultChannelHandler" verb="POST" path="DefaultChannel.ashx" type="Server.Channels.DefaultChannelHandler, Server"/>
</handlers>
</system.webServer>
When I publish the website on my localhost IIS7 I receive an error:
POST http://localhost/DefaultChannel.ashx 500 Internal Server Error
Could not load type 'Server.Channels.DefaultChannelHandler
The target framework of this project is .Net 2.0 I tried the Classic and Integrated Mode application pool for .Net 2.0 with no luck. I also tried converting the project to 4.0 and tried the Classic and Integrated Mode application pool for .Net 4.0 with no luck. I also tried adding the managed handler through IIS Manager's Handler Mappings.
If you have time please download the source (184kb) to reproduce the problem on your own machine. The zip contains a VS2010 solution (.Net 2.0). You could also try to convert this to .Net 4.0
I am using Windows 7 anyway if that matters. If you need more details, please drop your comments below. This is working fine by the way on my webdev server.
NOTE: I created a version of this question here as I believe it suits SO better (based on the tags and user base) than what I posted on SF https://serverfault.com/questions/245241/ashx-cannot-find-type-error-on-iis7-no-problems-on-webdev-server
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是来自 methodworx 的 AspNetComet 聊天代码示例。将其部署到本地开发环境时。我假设您没有自己的域,因此您将在
默认网站
下创建一个 Web 应用程序。这使得 http://localhost/DefaultChannel.ashx 和无效路径。然后,您必须附加与此类似的 Web 应用程序的目录名称。
http://localhost/WebApplicationName/DefaultChannel.ashx
。另一方面,AspNetComet 会遇到另一个错误,例如comet client does not exit
。我通过将服务引用
.svc
转换为.asmx
Web 服务解决了这个问题。This is an example chat code of AspNetComet from methodworx. When deploying it to your local development environment. I would assume that you don't have your own domain thus you will create a web application underneath the
Default Website
. That makeshttp://localhost/DefaultChannel.ashx
and invalid path.You then have to append the directory name of web application similar to this.
http://localhost/WebApplicationName/DefaultChannel.ashx
. On the other hand AspNetComet will encounter another error something likecomet client does not exist
.I have resolved this by converting the service reference
.svc
to a.asmx
web service.