visual studio 2012调试asp.net无法使用IIS7

时间:2022-09-01 23:42:52

I can´t run visual studio 2012 debug for asp net using IIS7.

我无法使用IIS7为asp网运行visual studio 2012调试。

I have already tried the following

我已经尝试了以下内容

ASP NET Settings in IIS

IIS中的ASP NET设置

.NET Compilation: Changed Default Language to c#

.NET编译:将默认语言更改为c#

IIS Settings

IIS设置

ASP:

ASP:

  • Changed script Language to c# (manually)
  • 将脚本语言更改为c#(手动)
  • Enable Client-side debugging: true
  • 启用客户端调试:true
  • Enable Server-side debugging: true
  • 启用服务器端调试:true

Script - Language: c#

脚本 - 语言:c#

Also I am using Asp Net v4.0 app pool

另外我使用的是Asp Net v4.0应用程序池

Is there any other settings I can change to try make it work?

是否有任何其他设置我可以更改以尝试使其工作?

EDIT:

编辑:

My user is part of Debbuger Users

我的用户是Debbuger用户的一部分

The error is the following:

错误如下:

Unable to start debbuging on the web server. The web server is not configured correctly. See help for common configuration erros.

无法在Web服务器上启动debbuging。未正确配置Web服务器。请参阅常见配置错误的帮助。

EDIT 2:

编辑2:

This is the log

这是日志

Software: Microsoft Internet Information Services 7.5
Version: 1.0
Date: 2012-12-18 11:29:55
Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
2012-12-18 11:29:55 ::1 DEBUG /tgpwebged/debugattach.aspx - 443 - ::1 - 403 7 5 43

EDIT 3:

编辑3:

I have manually configured the compilation element in web.config. This is the actuall config:

我已在web.config中手动配置了编译元素。这是执行配置:

<compilation batch="true" debug="true" defaultLanguage="C#" explicit="false" 
maxBatchGeneratedFileSize="10000" maxBatchSize="10000" 
numRecompilesBeforeAppRestart="100" strict="false" 
tempDirectory="C:\Windows\Temp" urlLinePragmas="false"> </compilation>

Also just for test purpose changed the user ASP NET V4 app pool runs under to my account. Not the SYSTEM.. my personal account. No success yet.

也只是为了测试目的改变了用户ASP NET V4应用程序池在我的帐户下运行。不是系统..我的个人帐户。还没有成功。

6 个解决方案

#1


1  

I have had this issue before (although not with VS2012) and the following things have worked:

我以前遇到过这个问题(虽然不是VS2012),但以下事情有效:

  • Ensure IIS is configured for Integrated Windows Authentication.
  • 确保为集成Windows身份验证配置IIS。
  • Make sure HTTP Keep Alives are enabled.
  • 确保启用HTTP Keep Alives。
  • Make sure http://localhost is in your trusted sites in your web browser.
  • 确保http:// localhost位于Web浏览器中的受信任站点中。

#2


0  

Can you attach your debugger to the w3wp process and debug that way ?

您可以将调试器附加到w3wp进程并以这种方式进行调试吗?

Here is an article: Attatch debugger to an IIS process

这是一篇文章:将调试程序附加到IIS进程

#3


0  

Try to run the following in the command line:

尝试在命令行中运行以下命令:

cd %windir%\Microsoft.NET\Framework\v4.0.30319
aspnet_regiis.exe -i

#4


0  

Typically you have to run Visual Studio as a local administrator for debugging to work.

通常,您必须以本地管理员身份运行Visual Studio才能进行调试。

#5


0  

I'm running into something similar on VS2010 with a site hosted on IIS7.5. I'm trying to hit F5 and get my website to start up an automatically attach a debugger.

我在VS2010上运行类似的东西,在IIS7.5上托管了一个站点。我正试图点击F5并让我的网站启动自动附加调试器。

I think the key is this line in your log:

我认为关键是你日志中的这一行:

2012-12-18 11:29:55 ::1 DEBUG /tgpwebged/debugattach.aspx - 443 - ::1 - 403 7 5 43

As far as I know, debugattach.aspx is some sort of hook that VS will try to invoke before it can actually start up and run your app. Details are a bit sketchy on the interwebs about what this thing actually is, however it does seem that if you don't get a 200 (success) VS won't be able to automatically attach. Basically it fails on step 1. In your log, you have a 403 (authorization error) for this request, I have a 404 (not found) in my log.

据我所知,debugattach.aspx是VS在实际启动并运行你的app之前会尝试调用的某种钩子。关于这件事实际上是什么的互联网上的细节有点粗略,但是看起来如果你没有得到200(成功)VS将无法自动附加。基本上它在步骤1中失败。在您的日志中,此请求有403(授权错误),我的日志中有404(未找到)。

In your specific case, you might have something in your IIS config that's blocking the DEBUG verb. It's a common security practice to block uncommon verbs or anything other than POST and GET. In my case, it's probably similar - the aspx extension is probably being filtered out. It could also be the default authentication settings for the app in question.

在您的特定情况下,您的IIS配置中可能包含阻止DEBUG谓词的内容。阻止罕见的动词或POST和GET以外的任何其他操作是一种常见的安全做法。就我而言,它可能类似 - aspx扩展可能被过滤掉了。它也可能是相关应用的默认身份验证设置。

Update: I did solve this on my end, and two separate things were wrong. First, I was using UrlScan.dll for security and it was blocking the DEBUG verb. Also, I was using a UrlRewrite rule to go from HTTP to HTTPS and the 302 redirect it generated also blocked this VS request. I was able to find both issues using the IIS Failed Request Tracing feature. The logs from that tool give some insight on what various modules and handlers in the pipeline are doing.

更新:我在最后解决了这个问题,两个不同的事情都错了。首先,我使用UrlScan.dll来保证安全,它阻止了DEBUG动词。此外,我使用UrlRewrite规则从HTTP转到HTTPS,它生成的302重定向也阻止了此VS请求。我能够使用IIS失败请求跟踪功能找到这两个问题。该工具的日志可以深入了解管道中各种模块和处理程序的作用。

Hopefully this helps!

希望这有帮助!

#6


0  

I've just had the same situation. I have solved it and here's how I did it:

我刚刚遇到了同样的情况。我已经解决了,这就是我做的方式:

  • Check if it's the right .NET Framework edition on the IIS.
  • 检查它是否是IIS上正确的.NET Framework版本。
  • Check your application pool's pipeline mode, for some apps - it only allows Classic mode.
  • 检查应用程序池的管道模式,对于某些应用程序 - 它只允许经典模式。
  • Check if there's any other application under the application which you want to debug.
  • 检查应用程序下是否有任何其他应用程序要调试。

#1


1  

I have had this issue before (although not with VS2012) and the following things have worked:

我以前遇到过这个问题(虽然不是VS2012),但以下事情有效:

  • Ensure IIS is configured for Integrated Windows Authentication.
  • 确保为集成Windows身份验证配置IIS。
  • Make sure HTTP Keep Alives are enabled.
  • 确保启用HTTP Keep Alives。
  • Make sure http://localhost is in your trusted sites in your web browser.
  • 确保http:// localhost位于Web浏览器中的受信任站点中。

#2


0  

Can you attach your debugger to the w3wp process and debug that way ?

您可以将调试器附加到w3wp进程并以这种方式进行调试吗?

Here is an article: Attatch debugger to an IIS process

这是一篇文章:将调试程序附加到IIS进程

#3


0  

Try to run the following in the command line:

尝试在命令行中运行以下命令:

cd %windir%\Microsoft.NET\Framework\v4.0.30319
aspnet_regiis.exe -i

#4


0  

Typically you have to run Visual Studio as a local administrator for debugging to work.

通常,您必须以本地管理员身份运行Visual Studio才能进行调试。

#5


0  

I'm running into something similar on VS2010 with a site hosted on IIS7.5. I'm trying to hit F5 and get my website to start up an automatically attach a debugger.

我在VS2010上运行类似的东西,在IIS7.5上托管了一个站点。我正试图点击F5并让我的网站启动自动附加调试器。

I think the key is this line in your log:

我认为关键是你日志中的这一行:

2012-12-18 11:29:55 ::1 DEBUG /tgpwebged/debugattach.aspx - 443 - ::1 - 403 7 5 43

As far as I know, debugattach.aspx is some sort of hook that VS will try to invoke before it can actually start up and run your app. Details are a bit sketchy on the interwebs about what this thing actually is, however it does seem that if you don't get a 200 (success) VS won't be able to automatically attach. Basically it fails on step 1. In your log, you have a 403 (authorization error) for this request, I have a 404 (not found) in my log.

据我所知,debugattach.aspx是VS在实际启动并运行你的app之前会尝试调用的某种钩子。关于这件事实际上是什么的互联网上的细节有点粗略,但是看起来如果你没有得到200(成功)VS将无法自动附加。基本上它在步骤1中失败。在您的日志中,此请求有403(授权错误),我的日志中有404(未找到)。

In your specific case, you might have something in your IIS config that's blocking the DEBUG verb. It's a common security practice to block uncommon verbs or anything other than POST and GET. In my case, it's probably similar - the aspx extension is probably being filtered out. It could also be the default authentication settings for the app in question.

在您的特定情况下,您的IIS配置中可能包含阻止DEBUG谓词的内容。阻止罕见的动词或POST和GET以外的任何其他操作是一种常见的安全做法。就我而言,它可能类似 - aspx扩展可能被过滤掉了。它也可能是相关应用的默认身份验证设置。

Update: I did solve this on my end, and two separate things were wrong. First, I was using UrlScan.dll for security and it was blocking the DEBUG verb. Also, I was using a UrlRewrite rule to go from HTTP to HTTPS and the 302 redirect it generated also blocked this VS request. I was able to find both issues using the IIS Failed Request Tracing feature. The logs from that tool give some insight on what various modules and handlers in the pipeline are doing.

更新:我在最后解决了这个问题,两个不同的事情都错了。首先,我使用UrlScan.dll来保证安全,它阻止了DEBUG动词。此外,我使用UrlRewrite规则从HTTP转到HTTPS,它生成的302重定向也阻止了此VS请求。我能够使用IIS失败请求跟踪功能找到这两个问题。该工具的日志可以深入了解管道中各种模块和处理程序的作用。

Hopefully this helps!

希望这有帮助!

#6


0  

I've just had the same situation. I have solved it and here's how I did it:

我刚刚遇到了同样的情况。我已经解决了,这就是我做的方式:

  • Check if it's the right .NET Framework edition on the IIS.
  • 检查它是否是IIS上正确的.NET Framework版本。
  • Check your application pool's pipeline mode, for some apps - it only allows Classic mode.
  • 检查应用程序池的管道模式,对于某些应用程序 - 它只允许经典模式。
  • Check if there's any other application under the application which you want to debug.
  • 检查应用程序下是否有任何其他应用程序要调试。