.ashx cannot find type error on IIS7 , no problems on webdev server

对着背影说爱祢 提交于 2020-01-03 05:16:51

问题


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


回答1:


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 makes http://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 like comet client does not exist.

I have resolved this by converting the service reference .svc to a .asmx web service.



来源:https://stackoverflow.com/questions/5253367/ashx-cannot-find-type-error-on-iis7-no-problems-on-webdev-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!