C# 指定的参数超出了有效值的范围。参数名称:站点

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17772216/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 10:26:25  来源:igfitidea点击:

Specified argument was out of the range of valid values. Parameter name: site

c#visual-studioiisweb-config

提问by Rahul_RJ

I am getting this Kind of Error like::

我收到这样的错误:

Specified argument was out of the range of valid values.Parameter name: site

指定的参数超出有效值范围。参数名称: 站点

while Debugging any of my Project.

在调试我的任何项目时。

I have also tried after Reinstalling My Visual Studio 2012. But again the same kind of problem I am getting while Debugging.

我在重新安装我的 Visual Studio 2012 后也尝试过。但我在调试时又遇到了同样的问题。

My System's Configurations are :

我的系统配置是:

  • Windows 8 : 32-bit
  • Visual Studio : 2012
  • Windows 8:32 位
  • 视觉工作室:2012

Exception is thrown at the time of Showing Web Page Like,

在 Showing Web Page Like 时抛出异常,

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: site]
   System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +298

[HttpException (0x80004005): Specified argument was out of the range of valid values.
Parameter name: site]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

采纳答案by MustafaP

If using IIS:

如果使用 IIS:

  • control panel
  • Programs
  • open or close windows features
  • tick internet information services
  • then restart your visual studio
  • 控制面板
  • 程式
  • 打开或关闭窗口功能
  • 勾选互联网信息服务
  • 然后重新启动你的视觉工作室

If using IIS Express:

如果使用 IIS Express:

Open 'Add/Remove Programs' from the old control panel and run a repair on IIS Express Or you might go Control Panel->> Programs->> Programs and Features->> Turn Windows features on or off->> Internet Information Servicesand check the checkbox as shown in the picture below:

从旧控制面板打开“添加/删除程序”并在 IIS Express 上运行修复 或者您可以转到控制面板->>程序->>程序和功能->>打开或关闭 Windows 功能->> Internet 信息服务并选中复选框,如下图所示:

enter image description here

在此处输入图片说明

回答by Wesley

When you start with a Specific Page while debugging your project, and you are using Local IIS, you might have filled a wrong value in the Specific Page textbox.

当您在调试项目时从特定页面开始并且使用本地 IIS 时,您可能在特定页面文本框中填充了错误的值。

(via Project Properties > Web > Start Action > Specific Page)

(通过项目属性 > Web > 开始操作 > 特定页面)

Wrong configuration:

错误的配置:

Specific Page: "http://localhost/MyApplication/Start/SpecificPage.aspx"
Project Url: "http://localhost/MyApplication"

Right configuration:

正确配置:

Specific Page: "/Start/SpecificPage.aspx"
Project Url: "http://localhost/MyApplication"

Note: Ignore the quotation marks.

注意:忽略引号。

回答by Johan Bakar

Instead of installing the bloated IIS, I get mine resolved by installing Internet Information Services Hostable Web Core from the Windows Features

我没有安装臃肿的 IIS,而是通过从 Windows 功能安装 Internet Information Services Hostable Web Core 来解决我的问题

回答by attila

If you are okay with using the built in Visual Studio Development server or you don't want to or cannot install IIS, you can change the web server the project uses by going into

如果您可以使用内置的 Visual Studio 开发服务器,或者您不想或无法安装 IIS,则可以通过进入更改项目使用的 Web 服务器

  1. Project Properties (right click project in solution explorer and select properties)

  2. select Web tab

  3. select "Use Visual Studio Development Server".

  1. 项目属性(右键单击解决方案资源管理器中的项目并选择属性)

  2. 选择网页标签

  3. 选择“使用 Visual Studio 开发服务器”。

I don't know how it happened to me, but somehow this option was changed to "Use Local IIS Web Server" for one of my projects.

我不知道它是如何发生在我身上的,但不知何故,对于我的一个项目,此选项已更改为“使用本地 IIS Web 服务器”。

回答by tanveer ahmad dar

I had the same issue i resolved it by repairing the iis server in programs and features.

我遇到了同样的问题,我通过在程序和功能中修复 iis 服务器来解决它。

GO TO

Controll panel > uninstall a program and then right click the installed iis express server (installed with Visual Studio) and then click repair.

控制面板 > 卸载程序,然后右键单击已安装的 iis express 服务器(与 Visual Studio 一起安装),然后单击修复。

this is how i solved this issue

这就是我解决这个问题的方法

回答by Michael K

For me, it was happening because I had switched over to "Run as Administrator". Just one instance of VS was running, but running it as admin threw this error. Switching back fixed me right up.

对我来说,这是因为我已经切换到“以管理员身份运行”。只有一个 VS 实例正在运行,但以管理员身份运行它会引发此错误。切换回来修复了我。

回答by Rich T

This occurred to me when I applied the 2017 Fall Creator Update. I was able to resolve by repairing IIS 10.0 Express (I do nothave IIS installed on my box.)

当我应用 2017 秋季创作者更新时,我想到了这一点。我能够通过修复 IIS 10.0 Express 来解决(我的机器上没有安装 IIS。)

Note:As a user pointed out in the comments,

注意:正如用户在评论中指出的那样,

Repair can be found in "Programs and Features" - the "classic" control panel.

修复可以在“程序和功能”-“经典”控制面板中找到。

回答by Sikandar Amla

I had the same issue with VS2017. Following solved the issue.

我在 VS2017 上遇到了同样的问题。以下解决了这个问题。

  1. Run Command prompt as Administrator.
  2. Write following two commands which will update your registry.
  1. 以管理员身份运行命令提示符。
  2. 编写以下两个命令来更新您的注册表。

reg add HKLM\Software\WOW6432Node\Microsoft\InetStp /v MajorVersion /t REG_DWORD /d 10 /f

reg add HKLM\Software\Microsoft\InetStp /v MajorVersion /t REG_DWORD /d 10 /f

reg add HKLM\Software\WOW6432Node\Microsoft\InetStp /v MajorVersion /t REG_DWORD /d 10 /f

reg add HKLM\Software\Microsoft\InetStp /v MajorVersion /t REG_DWORD /d 10 /f

This should solve your problem. Refer to this linkfor more details.

这应该可以解决您的问题。有关更多详细信息,请参阅此链接

回答by Don

Modify was greyed out for me, but adding the IIS Management Console under programs and features fixed this for me. Also on Windows 10 fall update.

修改对我来说是灰色的,但是在程序和功能下添加 IIS 管理控制台为我解决了这个问题。同样在 Windows 10 秋季更新中。

回答by Illuminati

I got this issue when trying to run a project targeting Framework 4.5 in VS2017. After changing it to Framework 4.6.X it got fixed by itself.

我在 VS2017 中尝试运行针对 Framework 4.5 的项目时遇到了这个问题。将其更改为 Framework 4.6.X 后,它自行修复。