heyinglongsimon
V2EX  ›  问与答

一个关于 ASP.NET Razor 的问题, localhost 与 127.0.0.1

  •  
  •   heyinglongsimon · Jan 5, 2018 · 2335 views
    This topic created in 3059 days ago, the information mentioned may be changed or developed.
    最近工作中要用到一个程序
    http://robin.oce.com/porthosinstall (程序很小,20 兆不到)
    安装了之后只能在本地浏览器地址栏通过 localhost 才能访问到,127.0.0.1 与本地 IP 均不能访问。(需要把程序映射到外网)
    故意修改了源文件使之报错,发现用的是 ASP.NET Razor。
    ASP.NET 实在是不熟悉。配置文件的也都尝试修改过,终究是不能通过 127.0.0.1 访问
    故请教下熟悉 ASP.NET 的各路大神。

    感激不尽
    5 replies    2018-01-05 22:40:26 +08:00
    in1024days
        1
    in1024days  
       Jan 5, 2018
    有两种可能,代码里面写死了或者配置上的问题。

    代码写死了的话,看看能不能用一些反编译工具把相关的值改了。工作量可能会比较大。

    配置上的话,看一下这个: https://docs.microsoft.com/en-us/iis/configuration/system.webserver/security/ipsecurity/
    qinxg
        2
    qinxg  
       Jan 5, 2018
    这个和 razor 没关系,不行做个反代
    hellommd
        3
    hellommd  
       Jan 5, 2018   ❤️ 1
    1. 编辑 PorthosWebserver.exe.config 文件
    在 <appSettings> 元素下加入 <add key="IsRemoteConnectionsAllowed" value="true" />

    2. 必须 “以管理员身份运行” PorthosWebserver.exe
    vjnjc
        4
    vjnjc  
       Jan 5, 2018
    另外一种可能是 localhost 被转成 ipv6 了,你试试::1
    heyinglongsimon
        5
    heyinglongsimon  
    OP
       Jan 5, 2018
    @hellommd 非常感谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5343 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 05:54 · PVG 13:54 · LAX 22:54 · JFK 01:54
    ♥ Do have faith in what you're doing.