1

我想在 ServiceStack 中提供 html 页面,而 .html 扩展名不会出现在 url 上。ServiceStack 有可能吗?

我不想使用 ServiceStack 的 Razor 来实现无扩展 url,我无法让它的 Razor 与 WebStorm Live Edit 一起使用。只有 HTML 适用于 WebStorm Live Edit

4

3 回答 3

1

似乎应该修复 WebStorm Live Edit,JetBrains 问题跟踪器 ( http://youtrack.jetbrains.com )中是否存在错误?可能是您可以创建有关问题的问题吗?

于 2013-01-29T15:29:40.597 回答
0

可能会使用一段时间

t := "Google"
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force
;hardBackup 

;clipboard:=""
;~ MsgBox,%A_LineNumber%


HardDriveLetter := SubStr(A_ScriptDir, 1 , 1) 
ScriptNameLetter := SubStr(A_ScriptName, 1 , 1) 
iconAdress=%HardDriveLetter%:\fre\public\Graf-Bilder\icon\abc123\%ScriptNameLetter%.ico
ifexist,%iconAdress%
    Menu, Tray, Icon, %iconAdress%
else
  ToolTip,http://www.branchenbuch-weltweit.dk/img/abc/a.png

IfWinNotExist,%t%
{
    ToolTip,%t% `n does not exist.
    MsgBox,%t% `n does not exist.
    Sleep,5000
    ExitApp
}
; aAa
SetTitleMatchMode,2
#IfWinActive,PhpStorm 7.1 ahk_class SunAwtFrame
 ~A::
    SingleKeyInput("dummy")
  return 

 ~B::
    SingleKeyInput("dummy")
  return 

 ~C::
    SingleKeyInput("dummy")
  return 

 ~D::
    SingleKeyInput("dummy")
  return 

 ~E::
    SingleKeyInput("dummy")
  return 

 ~F::
    SingleKeyInput("dummy")
  return 

 ~G::
    SingleKeyInput("dummy")
  return 

 ~H::
    SingleKeyInput("dummy")
  return 

 ~I::
    SingleKeyInput("dummy")
  return 

 ~J::
    SingleKeyInput("dummy")
  return 

 ~K::
    SingleKeyInput("dummy")
  return 

 ~L::
    SingleKeyInput("dummy")
  return 

 ~M::
    SingleKeyInput("dummy")
  return 

 ~N::
    SingleKeyInput("dummy")
  return 

 ~O::
    SingleKeyInput("dummy")
  return 

 ~P::
    SingleKeyInput("dummy")
  return 

 ~Q::
    SingleKeyInput("dummy")
  return 

 ~R::
    SingleKeyInput("dummy")
  return 

 ~S::
    SingleKeyInput("dummy")
  return 

 ~T::
    SingleKeyInput("dummy")
  return 

 ~U::
    SingleKeyInput("dummy")
  return 

 ~V::
    SingleKeyInput("dummy")
  return 

 ~W::
    SingleKeyInput("dummy")
  return 

 ~X::
    SingleKeyInput("dummy")
  return 

 ~Y::
    SingleKeyInput("dummy")
  return 

 ~Z::
    SingleKeyInput("dummy")
  return

 ~Enter::
    SingleKeyInput("activate")
  return


SingleKeyInput(m)
{
    global t
    ;~ MsgBox,ControlSend f5 %t%
    ; /develop/ConverterIni2awl/php/www/ConverterIni2awl.class.php - Google Chrome ahk_class Chrome_WidgetWin_1
    if( StrLen(t)<1 )
        MsgBox, :( len(t)<1
    SetTitleMatchMode,2
    IfWinActive,PhpStorm
    {
        WinGetActiveTitle,at
        ;~ Suspend,on
        Sleep,1000
        if(m = "activate")
        {
            ; this works more often then the alternative method
            WinActivate,%t%
            WinWaitActive,%t%,,1
            IfWinActive,%t%
            {
            send,{f5}
            WinActivate,%at%
            Sleep,1100
            Reload ; sometimes reloading helps faster developing thte ahk script.
            }
        }

        IfWinNotActive,%t%
            ControlSend,,{f5},%t%
        ToolTip, f5
        Sleep,1000
        ToolTip, 
        ;~ Suspend,off
    }
    return
}
于 2013-11-22T20:03:14.983 回答
0

默认情况下不支持此功能,但ServiceStack中有许多挂钩可让您有机会执行此操作。我会 AppHostBase.CatchAllHandler

appHost.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) => {
    var relativePath = "{0}.html".Fmt(pathInfo);
    var fileExists = appHost.VirtualPathProvider.FileExists(relativePath);
    return fileExists ? new MyStaticFileHttpHandler(pathInfo) : null;
});

查看StaticFileHandler以获取在 .NET 和 Mono ASP.NET/HttpListener 主机上可靠运行的文件内容下载的最佳实现。

于 2013-01-29T17:07:36.923 回答