简体   繁体   English

为什么更改 IIS Express 项目 URL 在 ASP.NET MVC 4.7.2 中不起作用?

[英]Why changing IIS Express Project URL does not work in ASP.NET MVC 4.7.2?

I have this setup to change the URL to 5002.我有这个设置来将 URL 更改为 5002。

在此处输入图片说明

After running, this the result.运行后,结果如下。

在此处输入图片说明

A few things to try;尝试一些事情;

  • Search through your project code (using find all) looking for instances of "5002" or whatever your port number was previously.搜索您的项目代码(使用 find all),寻找“5002”的实例或您之前的任何端口号。 You will be looking for references in generated code rather than code you have created yourself.您将在生成的代码中查找引用,而不是您自己创建的代码。

  • Try with a difference browser (Chrome / Firefox etc).尝试使用不同的浏览器(Chrome / Firefox 等)。

  • Shut down any other running applications.关闭任何其他正在运行的应用程序。

  • Try running without https.尝试在没有 https 的情况下运行。 If this works you can focus your effort on getting the developer certificates working.如果这有效,您可以将精力集中在使开发人员证书工作上。

  • Stop and start visual studio (its annoying how often this solves anomalies!)停止并启动visual studio(它解决异常的频率很烦人!)

  • Check that the IIS express instance is running in the tray - click on the tray, locate the respective running application and click browse.检查 IIS express 实例是否在托盘中运行 - 单击托盘,找到相应的运行应用程序并单击浏览。

  • Create a completely clean application using port 5002 and compare the two solutions to relevant differences.使用端口 5002 创建一个完全干净的应用程序,并比较两种解决方案的相关差异。

  • Reboot and try again - in case there are any other applications locking this port number.重新启动并重试 - 以防有任何其他应用程序锁定此端口号。

From our friends at MS support:来自我们 MS 支持的朋友:

"IISExpress uses http.sys for its communication and it requires SSL ports to be registered as Administrator. To avoid running Visual Studio as administrator, IIS Express reserves the port range 44300 - 44399 when it is installed. As long as you select a port within this range (which is what VS does) you do not need to run IISExpressAdminCmd to register the URL." "IISExpress 使用 http.sys 进行通信,它需要将 SSL 端口注册为管理员。为了避免以管理员身份运行 Visual Studio,IIS Express 在安装时保留了端口范围 44300 - 44399。只要您在其中选择一个端口在这个范围内(VS 所做的),您不需要运行 IISExpressAdminCmd 来注册 URL。”

via support link: https://developercommunity.visualstudio.com/content/problem/39430/changing-port-number-in-a-web-project-does-not-imm.html通过支持链接: https : //developercommunity.visualstudio.com/content/problem/39430/changed-port-number-in-a-web-project-does-not-imm.html

Solution #1 Use IIsExpressAdminCmd.exe to register the URL解决方案#1 使用 IIsExpressAdminCmd.exe 注册 URL

From cmd prompt go to directory C:\\Program Files (x86)\\IIS Express从 cmd 提示符转到目录 C:\\Program Files (x86)\\IIS Express

Run IISExpressAdmiCmd to register the url IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:5002/ -UseSelfSigned运行IISExpressAdmiCmd注册url IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:5002/ -UseSelfSigned

Solution #2 Run VS under admin context解决方案#2 在管理上下文下运行 VS

Solution #3 Switch the port to a pre-registered one 44300 - 44399解决方案#3 将端口切换到预先注册的端口 44300 - 44399

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在IIS Express和本地IIS之间进行调试/部署期间,ASP.NET MVC 5 C#URL不同 - ASP.NET MVC 5 C# URL is different during Debugging/Deploying between IIS Express and Local IIS 我在 iis express 中运行 asp.net core mvc 项目时遇到问题 - I have problem while running asp.net core mvc project in iis express ASP.NET MVC 模板项目开箱即用 - ASP.NET MVC Template project does not work out of the box Microsoft“身份平台”是否(轻松)与“(ASP.NET)身份框架”集成 - MVC5 和 .NET 4.7.2? - Does Microsoft 'Identity Platform' (easily) integrate with the '(ASP.NET) Identity Framework' - MVC5 & .NET 4.7.2? 在IIS Express或其他WebServer上部署ASP.NET MVC应用程序? - Deploy ASP.NET MVC App on IIS Express or an other WebServer? ASP.NET MVC和IIS Express-更改执行目录 - ASP.NET MVC and IIS Express - Change executing directory ASP.NET 5 MVC:无法连接到 Web 服务器“IIS Express” - ASP.NET 5 MVC: unable to connect to web server 'IIS Express' 如何在ASP.NET MVC,IIS Express中禁用请求验证 - How to disable request validation in ASP.NET MVC, IIS Express ASP.NET MVC 5,IIS Express 8-未达到索引 - ASP.NET MVC 5, IIS Express 8 - not hitting index 为什么更改ASP.NET MVC项目的输出路径会导致“无法加载类型MvcApplication”错误? - Why does changing the Output Path of my ASP.NET MVC project cause the “Could not load type MvcApplication” error?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM