V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
heyinglongsimon
V2EX  ›  问与答

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

  •  
  •   heyinglongsimon · 2018-01-05 05:28:33 +08:00 · 1453 次点击
    这是一个创建于 2302 天前的主题,其中的信息可能已经有所发展或是发生改变。
    最近工作中要用到一个程序
    http://robin.oce.com/porthosinstall (程序很小,20 兆不到)
    安装了之后只能在本地浏览器地址栏通过 localhost 才能访问到,127.0.0.1 与本地 IP 均不能访问。(需要把程序映射到外网)
    故意修改了源文件使之报错,发现用的是 ASP.NET Razor。
    ASP.NET 实在是不熟悉。配置文件的也都尝试修改过,终究是不能通过 127.0.0.1 访问
    故请教下熟悉 ASP.NET 的各路大神。

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

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

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

    2. 必须 “以管理员身份运行” PorthosWebserver.exe
    vjnjc
        4
    vjnjc  
       2018-01-05 12:45:14 +08:00
    另外一种可能是 localhost 被转成 ipv6 了,你试试::1
    heyinglongsimon
        5
    heyinglongsimon  
    OP
       2018-01-05 22:40:26 +08:00
    @hellommd 非常感谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5660 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 03:31 · PVG 11:31 · LAX 20:31 · JFK 23:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.