> For the complete documentation index, see [llms.txt](https://blog.zongsoft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://blog.zongsoft.com/guan-yu-iis-express-chang-yong-she-zhi.md).

# 关于 IIS Express 常用设置

2019-05-01

### 站点绑定

IIS Express Web 服务器默认只绑定了 `localhost` 的主机名，这就意味着无法通过内网或其他自定义域名进行访问，可通过如下操作添加其他绑定。\
\
在Web宿主项目中的 **.vs** 目录中的 **config** 子目录中，有名为“**applicationhost.config**”配置文件，打开它后，找到如下节点：

```
system.applicationHost/sites/site[name=xxxx]/bindings
```

1. 在该绑定集中的添加一个首节点，假定绑定端口号为： `12345`

```xml
<binding protocol="http" bindingInformation="*:12345:*" />
```

2. 以管理员方式运行“命令提示符”，然后在终端执行器中执行下面命令：

```shell
netsh http add urlacl url=http://*:12345:* user=everyone
```

***注：**&#x5982;果指定端口被其他 IIS Express 服务占用，可使用如下命令解除相关绑定：*

```shell
netsh http delete urlacl url=http://*:12345/
```

### 请求内容长度限制

IIS Express Web 服务器默认限制了HTTP的请求内容大小，这会导致在上传较大文件时请求被拒绝，通过如下方式可重置默认限制值。\
\
在Web宿主项目中的 **.vs** 目录中的 **config** 子目录中，有名为“**applicationhost.config**”配置文件，打开它后，找到如下节点：

```
system.webServer/security/requestFiltering
```

1. 在该节点下添加如下子节点，假定重新设置请求内容长度限制为： `500MB`

```xml
<requestLimits maxAllowedContentLength="524288000" />
```

2. 然后修改Web宿主项目的 **Web.config** 文件中的如下配置节：

```xml
	<system.web>
		<httpRuntime maxRequestLength="524288000" />
	</system.web>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://blog.zongsoft.com/guan-yu-iis-express-chang-yong-she-zhi.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
