无法在 Web 服务器上启动调试。无法启动 ASP.NET 调试 VS 2010、II7、Win 7 x64
我正在 Windows 7 x64 上运行 Visual Studio 2010(以管理员身份)、IIS 7。 我能够在 IIS 7 中运行 ASP.NET 网站,无需进行调试,但是当我按 F5 进行调试时,我得到:
无法在 Web 服务器上启动调试。无法启动 ASP.NET 调试。通过启动项目而不进行调试可以获得更多信息。
不幸的是,帮助链接对我帮助不大,并且导致了一大堆事情。
我检查了以下内容:
安全要求 - 我不记得之前必须做任何特别的事情。 IIS7中的工作进程是w3wp.exe。它说,如果它作为 ASPNET 或网络服务运行,我必须具有管理员权限才能调试它。我如何知道我是否需要在此处更改某些内容?
网站属性页>启动选项>调试器> ASP.NET 已检查。 使用自定义服务器设置为站点的 URL(无需调试即可正常工作)。
在
web.config
中启用调试。应用程序正在使用 ASP.NET 3.5(我最终想迁移到 4.0,但我需要处理一些迁移)。
应用程序池:分类.NET AppPool(也尝试过DefaultAppPool)。
有什么想法我下一步可以检查吗?
当然,安装 IIS、VS、创建网站并开始测试应该不那么难吧?
提前致谢。
I am running Visual Studio 2010 (as Admin), IIS 7 on Windows 7 x64.
I am able to run the ASP.NET web site in IIS 7 without debugging just fine, but when I press F5 to debug it, I get:
Unable to start debugging on the web server. Could not start ASP.NET debugging. More information may be available by starting the project without debugging.
Unfortunately the help link is not helping me much and leads down a heck of a large tree of things.
I checked the following:
Security requirements — I don't recall having to do anything special before. The worker process in IIS7 is w3wp.exe. It says that if it's running as ASPNET or NETWORK SERVICE I must have Administrator privileges to debug it. How do I find out if I need to change something here?
Web site Property Pages > Start Options > Debuggers > ASP.NET is checked.
Use custom server is set to the URL of the site (which works fine without debugging).Debugging is enabled in
web.config
.Application is using ASP.NET 3.5 (I want to move to 4.0 eventually but I have some migration to deal with).
Application pool: Classing .NET AppPool (also tried DefaultAppPool).
Any ideas where I can check next?
Surely it shouldn't be that hard to install IIS, VS, create a web site, and start testing it?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(30)
为了其他人的利益,在我的例子中,我已将应用程序池配置为使用我的 Windows 凭据来访问网络资源共享。自从上次调试解决方案以来,我重置了我的 Windows 密码。更改了应用程序池和 bada bing 中存储的密码。
For the benefit of others, in my case I had configured the application pool to use my windows credentials in order to access a network resource share. Since debugging the solution last I had reset my windows password. Changed password stored in app pool and bada bing.
对于我的场景,是对 web.config 中的 httpErrors 部分进行了更改,将其设置为:
导致了“无法在 Web 服务器上开始调试”问题。将其设置回“DetailedLocalOnly”的先前值修复了该问题。深入挖掘后,我发现实际上只是 401 错误设置导致了此问题:
注释掉 401 错误行也解决了该问题,我同意了,因为这样我就可以维护自定义错误处理并开始调试。
我仍然不知道为什么会发生这种情况。
For my scenario it was changes to the httpErrors section in web.config, setting it like this:
caused the "Unable to start debugging on the web server" issue. Setting it back to the previous value of "DetailedLocalOnly" fixed the issue. Digging a little deeper I discovered that it was actually just the 401 error setting that was causing this:
Commenting out the 401 error line fixed the issue as well, I went with that since I can then maintain the custom error handling and start with debugging.
I still have no idea why this is happening.
如果ApplicationPool Identity设置为自定义帐户并且计算机的密码已更改,您必须更新密码
If ApplicationPool Identity is set custom account and computer's password is changed, you have to update your password
请检查应用程序池。如果它被停止。重新启动它。
Plase check application pool. if it is stoped. restart it.
尝试调试 DNN(Dot Net Nuke)模块时遇到同样的问题。
结果你需要
在你的 web.config 中编译 debug="true": 。默认情况下,DNN 中的值为 false。原始来源在这里:
http://www.dnnsoftware.com/forums/forumid/111 /postid/189880/scope/posts
Had the same issue trying to debug a DNN (Dot Net Nuke) module.
Turned out you need to have compilation debug="true":
in your web.config. By default it is false in DNN. Original source here:
http://www.dnnsoftware.com/forums/forumid/111/postid/189880/scope/posts
实现重写模块后我遇到了完全相同的问题。
如果我从 web.config 文件中删除重写条目,则调试工作正常。
为了解决这个问题,我只是在调试时注释掉重写标签,就像这样......
然后在调试后删除注释。
一定是 Visual Studio 2010 中的一个错误。
I have exactly the same problem after implementing the rewrite module.
If I remove the rewrite entries from my web.config file, debugging works perfectly.
To get around this, I just to comment out the rewrite tags while debugging, like this...
I then remove the comments after debugging.
Must be an bug in visual studio 2010.
由于应用程序池在 IIS 中停止,我遇到了同样的错误。启动应用程序池后,问题得到解决。
I got the same error since Application pool was stopped in IIS. After starting the App Pool, the issue was resolved.
这是我为清除您指出的错误所做的操作。在文件系统中找到应用程序的 Web 文件夹,转到属性=>安全,单击高级按钮,然后单击所有者选项卡,单击编辑按钮并更改文件夹的所有者(具有正确的权限),并选中“替换子容器和对象的所有者”复选框。点击“应用”,然后我就开始工作了(能够调试)。
希望这对其他人有用。
Here is what I did to clear the error you noted. Locate the web folder for the app within the file system, go to Properties=>Security click the Advanced button then click the Owner tab, click the Edit button and change the owner (with the correct permissions) of the folder and checked the "Repalce owner on subcontainers and objects" checkbox. Click "Apply" and then I was in business (able to debug).
Hope this works for someone else.
终于为我的单一解决方案解决了这个问题。解决方案中的两个项目被设置为 IIS 中的站点。我进去并在身份验证下为两个项目启用了 ASP.Net 模拟...还有 VIOLA!终于,不再出现这种烦人的错误了!
Just finally fixed this for my single solution that was having this. Two of the projects in the solution were set as sites in IIS. I went in and enabled ASP.Net Impersonation under Authentication for both projects...and VIOLA! FINALLY, no more of this annoying error!
我在 VS 2012 中收到相同的错误消息,但没有以管理员身份运行。当我以管理员身份运行该应用程序时,我收到了一条不同且稍微有用的消息(我能够弄清楚)。华泰
I was getting the same error message in VS 2012, but was not running as Administrator. When I ran the app as administrator, I got a different and slightly more helpful message (which I was able to figure out). HTH
如果应用程序池在重新启动时遇到问题或只是不想重新启动,请验证 Windows 是否在 ASP.NET v4.0 或其他应用程序池上进行了最新更新。我的例子就是这样的。我只需重新启动计算机,然后重新启动 ASP.NET v4.0 应用程序池,一切就恢复正常了!
If App Pool has trouble restarting or simply doesn't want to restart, verify if windows made recent update on ASP.NET v4.0 or other App Pool. That is what happend in my case. I simply restarted my computer, then restarted ASP.NET v4.0 App Pool and everything was working again!
Dan,
除了 Aaron 的建议之外,请尝试以下
Dan,
In addition to Aaron's suggestions, try the following
当打开所有 IIS Windows 功能时,Windows 10 也出现同样的问题。切换到 Windows 8.1 后又出现问题。
根位于网站名称“http://MySite.local”(与操作系统版本无关)。
解决方案很简单
编辑
%SystemRoot%\System32\drivers\etc\ 中的主机文件
添加 ip 绑定行:
127.0.0.1 MySite.local
Had the same problem with Windows 10 when turned on all IIS windows features. Switched to Windows 8.1 and got problem again.
The root was in web site name "http://MySite.local" (not related to OS version).
And solution is simple
Edit hosts file in
%SystemRoot%\System32\drivers\etc\
Add line with ip binding:
127.0.0.1 MySite.local
由于代码缺陷,我今天出现了这个错误,该缺陷正在发布大量次数,导致IIS被请求淹没。这本质上锁定了IIS,因此,当我尝试调试时,它“超时”试图启动调试器。我只是重新启动了IIS,这花费了几分钟,然后解决了问题。
我确实希望此错误不那么通用,似乎有几种不同的方法来生产它。
I had this error come up today due to a defect in code that was posting back a tremendous amount of times causing IIS to be flooded with requests. This essentially locked up IIS and so when I tried to debug, it 'timed out' trying to start the debugger. I simply restarted IIS, which took a few minutes, and it solved the issue.
I sure do wish this error was less generic, seems like there are several different ways to produce it.
我在 Windows 8.1 上的 Visual Studio 2012 和 2013 中遇到了同样的问题。对我来说,修复方法是使用“打开或关闭 Windows 功能”将 Windows 身份验证添加到 IIS
I had the same problem in Visual Studio 2012 and 2013 on Windows 8.1. For me the fix was to add Windows Authentication to IIS using 'Turn Windows features on or off'
确保您网站的应用程序池使用正确的框架版本。我在 ASP.Net 2005 站点上收到“无法开始调试”错误。它在 Windows 7 上错误地使用了 DefaultAppPool(我相信它使用的是 .Net Framework 4)。我创建了一个基于 .Net Framework 2 的新应用程序池,并将其分配给问题网站。之后调试工作正常。
Be sure your site's Application Pool uses the correct framework version. I got the "Unable to start debugging" error on an ASP.Net 2005 site. It was incorrectly using the DefaultAppPool on Windows 7 (which I believe was using .Net Framework 4). I created a new a App Pool based on .Net Framework 2 and assigned it to the problem web site. After that debugging worked fine.
检查您的 IIS 上的网站是否未停止。
我修复了它,使我的网站可以运行。 :D
Check if your website on IIS is not stop.
I fixed it put my web site to run. :D
我遇到了这个问题,最终意识到我的 ASP.net 没有在 IIS 中正确注册。如果在 Visual Studio 之前安装 IIS 服务器,则可能会发生这种情况。要解决此问题,请使用命令 aspnet_regiis -i
有关详细信息,请访问链接
I had this problem and eventually realized that I ASP.net is not registered properly with IIS. This can happen when IIS server is installed before Visual Studio. To fix this issue, use the command aspnet_regiis -i
Further information can be found in the link
有同样的问题。如果您在 IIS 上安装了 SSL 证书,并且尝试从 Visual Studio 中调试它,则需要将 IIS 上的应用程序设置为忽略证书。
had same issue. If you have SSL certificate installed on IIS and if you are trying to debug it from Visual Studio then you need to set your application on IIS to ignore certificate.
我遇到了同样的问题,发现这是因为我在
Web.config
结束标记后错误地输入了一个字符。我的Web.config
最后看起来像这样:h
。 “h”是结束标记之后的额外字符。I had the same issue and found that it was caused because i had a character mistakenly typed in my
Web.config
after the end tag. MyWeb.config
looked like this right at the end:</section>h
. The "h" was an extra character after the closing tag.删除这样的刺痛: web.config 中的 targetFramework="4.0" 或将 AppPool 更改为适当的框架版本。
remove sting like this: targetFramework="4.0" in web.config or change AppPool to appropriate framework version.
卸载 IIS UrlScan Extension 解决了我的问题。
Uninstalling the IIS UrlScan Extension solved the problem for me.
我也遇到过同样的问题,但它是在 Visual studios 自己的 Web 开发服务器上而不是 IIS 上。解决方法是取消选中项目属性下 Web 选项卡中的选项,将服务器设置应用于所有用户(存储在项目文件中。)。希望它将节省一些人的宝贵时间。
I had faced the same problem but it was on Visual studios's own web development server instead of IIS.The get around is to uncheck the option in Web tab under project properties, Apply server settings to all users(store in project file.).Hope it will save some one's valuable time.
我也有同样的问题。
上面所有的答案对我来说都不起作用。
解决办法是手动删除bin和obj文件夹。
I had the same problem.
All the answers above did not work for me.
The solution was to delete the bin and obj folder manually.
我也发现了这个问题,但它与 @Kirk 解释的和 URL 重写最相似。
就我而言,有人已将此更改签入到 MVC 项目的 web.config 文件中:
由于 Web 服务器上不允许使用 .aspx 文件扩展名,因此
/debugattach.aspx
URL 被拒绝,从而阻止调试器停止运行。一旦我删除了这个配置,它又可以工作了。I found this issue too but it was most similar to what @Kirk explained and URL rewriting.
In my case someone had checked in this change to the web.config file for a MVC project:
Because .aspx file extensions were not allowed on the web server, the
/debugattach.aspx
URL was denied, preventing the debugger from running. Once I removed this configuration it worked again.当我在 Visual Studio 中创建应用程序,然后在属性中创建用于本地 IIS 的虚拟目录时,我遇到了同样的问题。如果有人遇到此错误,那是因为 VS 在错误的 AppPool 下创建应用程序,即在不适合您需求的 AppPool 下创建应用程序。
如果是这种情况,请转到 IIS 管理器,选择应用程序,转到基本设置,然后将应用程序池更改为应用程序,然后就可以了。
I had the same problem when I created application in Visual Studio, and then in properties created virtual directory for use with local IIS. If someone has this error it is because VS creates application under wrong AppPool, i.e. under AppPool which doesn't suit your needs.
If this is the case, go to IIS Manager, select App, Go to Basic settings and change AppPool for App and you are good to go.
我最近遇到了同样的错误,就我而言,结果是存在重复的 MIME 类型。我最近添加了两个最初未出现在列表中的内容。 IIS 让我添加它们,只是当我决定再次检查站点的 MIME 类型(作为诊断过程的一部分)时,我在 IIS 中也遇到了错误。它引用了 web.config 中的重复项。当我返回 web.config 文件时,我注意到添加了一个名为 的新部分,其中包括最近添加的两种 MIME 类型。删除该部分,生活又美好了!希望这可以帮助其他尚未通过任何其他建议解决问题的人。
I got this same error recently and in my case it turned out that there were duplicate MIME types. I had recently added two that didn't show up in the list initially. IIS let me add them and it was only when I decided to check the MIME types for the site again as part of my diagnostic process that I got an error in IIS as well. It referenced duplicates in web.config. Once I went back into the web.config file I noticed that a new section called had been added, which included the two recently-added MIME types. Deleted that section and life is good again! Hoping this may help others who haven't managed to fix the issue with any of the other suggestions.
尝试访问 IIS 并检查以确保您正在使用的应用程序池已启动。很多时候,您会产生关闭应用程序池的错误。您只需右键单击并开始,就可以开始了。
Try going to IIS and checking to make sure the App Pool you are using is started. A lot of times, you will produce an error that shuts down the app pool. You just need to right click and Start and you should be good to go.
事实证明,罪魁祸首是 IIS Url Rewrite 模块。我定义了一条规则,将对 Default.aspx(被设置为网站的起始页)的调用重定向到网站的根目录,以便我可以规范的主页 URL。然而,显然 VS 对此有问题并且感到困惑。当我使用 Helicon ISAPI_Rewrite 时,这个问题没有发生,所以我什至没有想到去检查。
我最终从头开始创建了一个全新的网站,并将项目/文件一点一点地移植到我的解决方案中,并重建我的 web.config 直到我发现这一点!
好吧,至少现在我使用 .NET 4.0 有了一个稍微干净一点的网站(到目前为止,希望我不会遇到任何困难)——但是多么痛苦啊!
Turns out that the culprit was the IIS Url Rewrite module. I had defined a rule that redirected calls to Default.aspx (which was set as the start page of the web site) to the root of the site so that I could have a canonical home URL. However, apparently VS had a problem with this and got confused. This problem did not happen when I was using Helicon ISAPI_Rewrite so it didn't even occur to me to check.
I ended up creating a whole new web site from scratch and porting projects/files over little by little into my solution and rebuilding my web.config until I found this out!
Well, at least now I have a slightly cleaner site using .NET 4.0 (so far, hopefully I won't run into any walls)--but what a pain!
Visual Studio 在启动时将(由于某种原因)尝试访问 URL:
如果您有一个重写规则来重定向(或以其他方式捕获),例如/部分的开头:
.aspx
文件,到其他地方,那么您将收到此错误。解决方案是将此部分添加到/ 将确保捕获这一特定请求,不执行任何操作,最重要的是停止执行,这样您的其他规则都不会运行。这是一个强大的解决方案,因此请随意将其保留在您的配置文件中以进行生产。
web.config
的Visual Studio, when starting up, will (for some reason) attempt to access the URL:
If you have a rewrite rule that redirects (or otherwise catches), say,
.aspx
files, somewhere else then you will get this error. The solution is to add this section to the beginning of yourweb.config
's<system.webServer>/<rewrite>/<rules>
section:This will make sure to catch this one particular request, do nothing, and, most importantly, stop execution so none of your other rules will get run. This is a robust solution, so feel free to keep this in your config file for production.