gpt4 book ai didi

.net - 无法使用 HTTPS 使 ServiceStack 在 IIS6 中工作

转载 作者:行者123 更新时间:2023-12-04 11:12:30 24 4
gpt4 key购买 nike

我在让 ServiceStack 与 IIS6 中的 HTTPS 一起工作时遇到了问题,我似乎找不到任何有关设置的文档。
目前我有一个像这样的端点设置 - http://example.com/api.ashx .当我浏览到这个时,我得到了有用的 ServiceStack 生成的页面,它解释了 http://example.com/api.ashx/metadata 上可用的 API。 .
当我浏览到 https://example.com/api.ashx (注意 https)我反而收到此错误消息 -

Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /api.ashx



我在我的 web.config 中有以下设置(按照这里的示例 - http://www.servicestack.net/ServiceStack.Hello/) -
<!-- ServiceStack: Required to host at: /api.ashx -->
<location path="api.ashx">
<system.web>
<httpHandlers>
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/>
</httpHandlers>
</system.web>

在我本地的 Windows 7 机器上,我运行的是 IIS7,它运行良好,但测试和实时环境仍在使用 IIS6,我无法让它在那里工作。

使用 https 时,其他常规 aspx 页面工作正常。

我会很感激任何能在正确方向上插入我的人!

最佳答案

IIS 6 的问题在于 IIS 6.0 请求管道无法识别没有 ASP.NET 扩展名的路径,例如 .aspx 不会传递给 ASP.NET isapi 处理程序。因此,通常有 2 个选项可以实现这一点,以便您可以让 ServiceStack 在 IIS 6 上运行:

  • 将 Web.Config 中的 servicestack 路径从 '*' 改为 'servicestack.ashx'







  • 为您的虚拟目录添加通配符映射以将所有未处理的请求传递给 ASP.NET:
    按照以下步骤使用 IIS 6.0 创建通配符脚本映射:
  • 右键单击网站并选择属性
  • 选择主目录选项卡
  • 单击配置按钮
  • 选择映射选项卡
  • 单击“插入”按钮(参见图 4)
  • 将 aspnet_isapi.dll 的路径粘贴到可执行字段中(您可以从 .aspx 文件的脚本映射中复制此路径)
  • 取消选中标有验证文件存在
  • 的复选框
  • 单击确定按钮

  • IIS 6.0 Wildcard mapping

    关于.net - 无法使用 HTTPS 使 ServiceStack 在 IIS6 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10005222/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com