本文介绍了无法获取ServiceStack在IIS6工作与HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题让ServiceStack与在IIS6 HTTPS工作,我似乎无法找到有关这件事的任何文件。目前,我有一个端点设置像这样 - http://example.com/api.ashx 。当我浏览到这一点,我得到的有用ServiceStack生成的网页,其中介绍了在 http://example.com/api.ashx可用的API /元。当我浏览到 https://example.com/api.ashx (注意HTTPS),而不是我得到这个错误信息 -

我有以下设立在我的web.config(按照例如在这里 - http://www.servicestack.net/ServiceStack.Hello/) -

 <  -  ServiceStack:托管,需要在:/api.ashx  - >
    <位置路径=api.ashx>
        <的System.Web>
            < HttpHandlers的>
                <添加路径=*TYPE =ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory,ServiceStack动词=*/>
            < / HttpHandlers的>
        < /system.web>
 

在我的本地Windows 7中我运行IIS7,它工作得很好,但测试和现场环境中仍在使用IIS6,我不能让它在那里工作。

其他普通的aspx页面精细工作使用https的时候。

我AP preciate人谁可以给我推在正确的方向!

解决方案

与IIS 6的问题是,在IIS 6.0请求管道无法识别的路径没有一个ASP.NET扩展如的.aspx不会被传递到在ASP.NET ISAPI处理程序。所以,一般有2种选择让这种情况发生,这样你就可以得到ServiceStack在IIS 6中运行:

  1. 更​​改从servicestack路径Web.Config中'*'到'servicestack.ashx

    <的System.Web>

    < HttpHandlers的>    <添加路径=servicestack.ashxTYPE =ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory,ServiceStack动词=*/>  < / HttpHandlers的>

    < /system.web>

  2. 添加一个通配符映射为你的虚拟目录传递所有未处理的请求ASP.NET:请按照下列步骤来创建一个通配符脚本映射与IIS 6.0:

    1. 右键点击一个网站,并选择属性
    2. 选择主目录标签
    3. 点击配置按钮
    4. 选择映射标签
    5. 单击插入按钮(见图4)
    6. 粘贴路径到Aspnet_isapi.dll到可执行场(你可以从脚本映射.aspx文件复制这条道路)
    7. 取消选中标记确认文件是否存在复选框
    8. 单击OK按钮

I'm having a problem getting ServiceStack to work with HTTPS in IIS6 and I can't seem to find any documentation on setting this up.Currently I have an endpoint setup like so - http://example.com/api.ashx. When I browse to this, i get the useful ServiceStack generated page which explains the APIs available at http://example.com/api.ashx/metadata.When i browse to https://example.com/api.ashx (notice https) i instead get this error message -

I have the following set up in my web.config (as per example here - 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>

On my local Windows 7 box i'm running IIS7 and it works just fine but the test and live environments are still using IIS6 and i can't get it to work there.

Other regular aspx pages are working fine when using https.

I'd appreciate anyone who can give me a push in the right direction!

解决方案

The problem with IIS 6 is that the IIS 6.0 request pipeline doesn't recognize a path without an ASP.NET extension e.g .aspx doesn't get passed to the ASP.NET isapi hander. So there are generally 2 options for getting this to happen so you can get ServiceStack to run on IIS 6:

  1. Change the servicestack path in Web.Config from '*' to 'servicestack.ashx'

    <system.web>

    <httpHandlers> <add path="servicestack.ashx" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/> </httpHandlers>

    </system.web>

  2. Add a wildcard mapping for your virtual directory to pass all unhandled requests to ASP.NET:Follow these steps to create a wildcard script map with IIS 6.0:

    1. Right-click a website and select Properties
    2. Select the Home Directory tab
    3. Click the Configuration button
    4. Select the Mappings tab
    5. Click the Insert button (see Figure 4)
    6. Paste the path to the aspnet_isapi.dll into the Executable field (you can copy this path from the script map for .aspx files)
    7. Uncheck the checkbox labeled Verify that file exists
    8. Click the OK button

这篇关于无法获取ServiceStack在IIS6工作与HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-17 01:44