我正在尝试将Microsoft.AspNet.FriendlyUrls添加到我的web.config文件中。 (这是必要的,因为我需要在Mono上运行网站,Mono还不支持System.Web.HttpApplication.RegisterModule)
web.config的system.webServer部分看起来像这样(简化):
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<add name="FriendlyUrls" type="Microsoft.AspNet.FriendlyUrls, FriendlyUrls" preCondition="managedHandler"/>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler"/>
</modules>
</system.webServer>
尝试运行该站点(来自Visual Studio)会出现此错误:
Could not load file or assembly 'FriendlyUrls' or one of its dependencies. The system cannot find the file specified.
我已经检查了bin目录,并且有Microsoft.AspNet.FriendlyUrls.dll。删除FriendlyUrls行允许应用程序启动就好了。
如何将FriendlyUrls模块添加到web.config?这是解决Mono问题的正确方法吗?
UPDATE 根据Jester的建议,我更改了类型:
type="Microsoft.AspNet.FriendlyUrls.FriendlyUrl, Microsoft.AspNet.FriendlyUrls"
现在错误是:
Microsoft.AspNet.FriendlyUrls.FriendlyUrl, Microsoft.AspNet.FriendlyUrls does not implement IHttpModule.