通过IP访问asp.net核心API的IISExpress [英] Accessing IISExpress for an asp.net core API via IP

查看:79
本文介绍了通过IP访问asp.net核心API的IISExpress的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行在IIS Express上的asp.net核心项目.网址( http://localhost:53142/

I have an asp.net core project running on IIS Express. The URLs (http://localhost:53142/ and https://localhost:44374/) work if I type into my browser as localhost, however, if i put in my IPv4 ip address (192.168.1.72) they don't work.

并排

我可以ping通192.168.1.72地址.

I can ping the 192.168.1.72 address just fine.

为什么我不能通过ip访问,我该怎么做?

Why can't I access via ip, and how would I do so?

推荐答案

IIS Express默认情况下不允许远程连接.

IIS Express does not allow remote connections by default.

这里有两个选项供您选择:

Here are two options for you:

  1. 配置为像

  1. Configure to use UseKestrel like

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .UseUrls("http://0.0.0.0:5000;https://0.0.0.0:5001")
        .UseKestrel()
        .UseStartup<Startup>();

然后,在VS中使用ProjectName运行项目,您将可以通过http//ip:5000

Then, run project with ProjectName from VS, you will be able to access by http//ip:5000

尝试创建IIS调试配置文件

Try to create IIS Debug profile

以管理员身份运行VS 2017->右键单击项目->属性->调试->新建->输入IIS->启动选择IIS->启动IIS配置文件->使用IP地址访问

Run VS 2017 as administrator-> Right Click project-> Properties->Debug->NEW->Enter IIS->Launch choose IIS-> Launch IIS Profile-> Access with ip address

更新:

如果您坚持使用IIS Express,请尝试VS扩展传送带通过Keyoti

If you insist on IIS Express, try the VS Extension Conveyor by Keyoti

这篇关于通过IP访问asp.net核心API的IISExpress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆