在 VS2010 内部将端口 80 与 IIS Express 一起使用

发布于 2024-11-01 23:38:14 字数 1474 浏览 5 评论 0原文

我有一个应用程序试图在 VS2010 的 IIS Express 下的开发系统上运行,我需要使用端口 80,但我无法让它工作。我查找了有关保留 80 端口的信息。 http://learn.iis.net/page.aspx /1005/handling-url-binding-failures-in-iis-express/

但即使这样做之后,我仍然从 vs2010 收到一个错误,上面写着 “无法启动 IIS Express Web 服务器。端口“80”正在使用中。”

我不知道还能尝试什么。我使用 Process Hacker 来追踪端口 80,它似乎被运行在进程 ID 4 上的 System 使用,该进程是 NT 内核和系统进程。我不知道这是否会阻止我使用该端口。我想这可能是 http.sys 持有该端口的结果,因此没有其他东西可以使用它?

我确实通过修改 C:\Users\[MyUser]\Documents\IISExpress\config\applicationhost.config 文件的默认绑定,设法让 IIS Express 在端口 80 上运行,虽然我可以以这种方式手动启动 IIS Express,VS 然后会收到错误,因为该端口上已存在绑定。因此,我将其更改回 8080,使用 VS2010 中的按钮创建虚拟目录(我猜这与输入站点绑定相同),但当我去调试应用程序时仍然收到错误。 VS2010 中是否有硬编码的内容不允许它在端口 80 上启动 IIS Express?

更新&修复:好的,所以我发现了更多需要检查的内容,并且确实解决了我的问题,但没有完全解决。一篇文章建议确保我没有安装 SQL 报告服务,因为它可以在端口 80 上进行监控,我曾经安装过它,但现在不再安装了,这不是我遇到的问题。然而我确实意识到我已经安装了 WebDeploy。它与 Web 平台安装程序 中的 VS2010 SP1 捆绑包捆绑在一起。这很好,因为我确实需要 WebDeploy 的客户端工具,但它还在我的系统上安装了正在监视端口 80 的代理。我转到我的服务列表并停止了 Web Deploy Agent Service 。完成此操作后,我现在可以在 VS2010 中使用 IIS Express 的端口 80。

与在 IIS Express 中的端口 80 上运行相关的新问题 但是我的应用程序是一个 MVC3 应用程序,我遇到了一个问题,因为 MVC3 根本没有捕获我的请求,所以它不会触发我的控制器操作或类似的东西,而是我的应用程序根目录中的一个 txt 文件可以访问,因此我知道 IIS Express 正在为我的网站提供服务。有人在端口 80 上的 IIS Express 中运行 MVC3(我不知道它是否是 MVC3 独有的)时遇到任何问题?

I've got an app that I am trying to run on my dev system under IIS Express from VS2010 that I need to use port 80 for, but I can't get it to work. I've looking up information talking about port 80 being reserved.
http://learn.iis.net/page.aspx/1005/handling-url-binding-failures-in-iis-express/

But even after doing that I still get an error from vs2010 that says
"Unable to launch the IIS Express Web server. Port '80' is in use."

I don't know what else to try. I've used Process Hacker to track down port 80 and it seems to be used by System running on process ID 4, which is the NT Kernel and System process. I don't know if that would prevent me from using the port though. I thought maybe that was a result of http.sys holding that port so nothing else could use it?

I did managed to get IIS Express to run on port 80 by modifying the default binding of the C:\Users\[MyUser]\Documents\IISExpress\config\applicationhost.config file, and while I can start IIS Express manually this way, VS then gets an error because a binding already exists on that port. So I change it back to 8080, create the virtual directory using the button within VS2010 (which I'm guessing is the same as entering a site binding) but I still get an error when I go to debug the application. Is there something hardcoded in VS2010 that won't let it start IIS Express on port 80?

UPDATE & FIX: Ok, so I found a few more things to check and I did resolve my problem but not completely. One post suggested making sure I did not have SQL reporting services installed as it can monitor on port 80, I used to have it installed but not anymore and was not the problem I was encountering. I did however realize that I have WebDeploy installed. It was bundled with the VS2010 SP1 bundle from the Web Platform Installer. This is fine as I do want the client tools from WebDeploy, but it also installed the agent on my system which was monitoring on port 80. I went to my list of services and stopped the Web Deploy Agent Service. Soon as I did this I can now use port 80 for IIS Express from within VS2010.

New Issue related to running on port 80 in IIS Express
However my application is an MVC3 App, and I've run into a problem because the MVC3 isn't capturing my request at all, so It's not firing my controller actions or anything like that, but a txt file in the root of my app can be reached so I know it's my site that IIS Express is serving up. Anyone have any issues running an MVC3 (I don't know if it's exclusive to MVC3 or not) in IIS Express on port 80?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

请叫√我孤独 2024-11-08 23:38:14

只是发布我自己对此问题的答案,以便我可以将问题标记为已回答。
检查http://learn.iis.net/page。 aspx/1005/handling-url-binding-failures-in-iis-express/
如果已安装 Web 部署代理服务,请禁用它。

Just posting my own answer for this problem so I can mark the question as answered.
Check http://learn.iis.net/page.aspx/1005/handling-url-binding-failures-in-iis-express/
Disable the Web Deploy Agent service if you have it installed.

烟织青萝梦 2024-11-08 23:38:14

就我而言,我通过停止“SQL Server Reporting Services”解决了问题,

您可以在控制面板中找到它

- >服务

in my case i solved the issue by stop "SQL Server Reporting Services"

you can find it in

control panel -> sevices

久伴你 2024-11-08 23:38:14

非常感谢您发现“Web 部署代理”服务!这是最近才打开的,因为我所有这些工作都完美,今天安装了 IIS Express 的更新版本,并在端口 80 上遇到了完全相同的问题。所以现在我已经关闭了 Web 部署代理,我的系统再次正常工作。

至于 ASP.NET MVC3,它在端口 80 和端口 443 上对我来说非常有用。绑定这两个端口需要做相当多的工作,以便 IIS Express 能够作为普通用户使用它们(大部分工作来自您在上面发布的链接),并安装我们使用的 SSL 证书。我手动创建了 applicationhost.config 文件中的所有条目以使其正常工作,相应的站点部分如下:

    <sites>
        <site name="PHP: A Main" id="2144116512">
            <application path="/">
                <virtualDirectory path="/" physicalPath="C:\var\www\amain\www" />
                <virtualDirectory path="/images" physicalPath="C:\var\www\images" />
            </application>
            <application path="/admin">
                <virtualDirectory path="/" physicalPath="C:\var\www\amain\www\admin" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:80:test.amainhobbies.com" />
                <binding protocol="https" bindingInformation="*:443:test.amainhobbies.com" />
            </bindings>
        </site>
        <siteDefaults>
            <logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
            <traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
        </siteDefaults>
        <applicationDefaults applicationPool="Clr4IntegratedAppPool" />
        <virtualDirectoryDefaults allowSubDirConfig="true" />
    </sites>

请注意,我的站点是 PHP 和 ASP.NET MVC3 的组合站点,因为我们正在重写整个内容都在 ASP.NET MVC3 上运行,因此该网站的大部分内容仍然是 PHP,但许多新内容现在正在运行 ASP.NET MVC3,这些内容对我有用。

您的 IIS Express 是否可以在 Visual Studio 之外与 MVC3 正常工作,或者 MVC3 的东西根本无法工作?

THANK YOU very much for you discovering of the 'Web Deploy Agent' service! This is something that only recently got turned on as I had all this working perfectly and just today installed the updated version of IIS Express, and ran into the exact same problem with port 80. So now that I have turned off the Web Deploy agent, my system works correctly again.

As for ASP.NET MVC3, that works great for me on port 80 and port 443. It was quite a bit of work to bind both those ports so that IIS Express was able to use them as a normal user (most of it from the link you posted above), and to install the SSL certificate we use. I manually created all the entries in my applicationhost.config file to get this working, and the appropriate sites section is below:

    <sites>
        <site name="PHP: A Main" id="2144116512">
            <application path="/">
                <virtualDirectory path="/" physicalPath="C:\var\www\amain\www" />
                <virtualDirectory path="/images" physicalPath="C:\var\www\images" />
            </application>
            <application path="/admin">
                <virtualDirectory path="/" physicalPath="C:\var\www\amain\www\admin" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:80:test.amainhobbies.com" />
                <binding protocol="https" bindingInformation="*:443:test.amainhobbies.com" />
            </bindings>
        </site>
        <siteDefaults>
            <logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
            <traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
        </siteDefaults>
        <applicationDefaults applicationPool="Clr4IntegratedAppPool" />
        <virtualDirectoryDefaults allowSubDirConfig="true" />
    </sites>

Note that my site is a combined PHP and ASP.NET MVC3 site, as we are in the process of re-writing the entire thing to run on ASP.NET MVC3, so most of the site is still PHP but lots of new stuff is now running ASP.NET MVC3, and that stuff works for me.

Does your IIS Express work properly with MVC3 outside of Visual Studio, or is the MVC3 stuff just not working at all?

活泼老夫 2024-11-08 23:38:14

我没有安装 Web 部署代理,但遇到了这个问题。您还可以通过运行此命令来找出哪个应用程序或服务正在使用该端口,然后在任务管理器中跟踪它来修复此问题。

netstat -o -n -a | netstat -o -n -a | findstr 0.0:80

然后打开任务管理器,转到进程,单击复选框“显示所有用户的进程”,然后单击查看菜单并转到列,添加 PID 列。

将 netstat 命令中的进程 ID 与任务管理器中的 PID 相匹配,您将找到正在使用该端口的服务或应用程序。

I didn't have the Web Deploy Agent installed but ran into this issue. You can also fix this by running this command to find out which application or service is using the port and then trace it down in Task manager.

netstat -o -n -a | findstr 0.0:80

Then open Task manager, go to Processes, click the checkbox "Show processes for all users" and then click the View menu and Go to the Columns, add the PID column.

Match the Process ID from the netstat command to the PID in task manager and you will find the service or application that's using the port.

执手闯天涯 2024-11-08 23:38:14

该解决方案帮助了我。

在 Windows 7 或 Windows Vista 上,从提升的命令提示符运行以下命令:
console

netsh http add urlacl url=http://localhost:80/ user=everyone

此命令将允许任何用户的应用程序(包括您自己的 IIS Express 实例)使​​用端口 80 运行,而无需管理权限。要限制您自己的访问权限,请将“所有人”替换为您的 Windows 身份。

取自该来源 -> https://learn.microsoft.com/en-us/iis/extensions/using-iis-express/handling-url-binding-failures-in-iis-express

That solution helped me.

On Windows 7 or Windows Vista, from an elevated command prompt, run the following command:
console

netsh http add urlacl url=http://localhost:80/ user=everyone

This command will allow any user's application (including your own IIS Express instances) to run using port 80 without requiring administrative privileges. To limit this access to yourself, replace "everyone" with your Windows identity.

Taken from that source -> https://learn.microsoft.com/en-us/iis/extensions/using-iis-express/handling-url-binding-failures-in-iis-express

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文