我正在尝试运行以下代码,但出现错误“其他信息:匿名身份无法执行模拟”。任何想法如何解决这个问题。
WindowsIdentity windowsIdentity = (WindowsIdentity) Thread.CurrentPrincipal.Identity;
WindowsImpersonationContext impersonationContext = windowsIdentity.Impersonate();
我的web.config。
标记要处理的每个错误。
"On" Always display custom (friendly) messages.
"Off" Always display detailed ASP.NET error information.
"RemoteOnly" Display custom (friendly) messages only to users not running
on the local Web server. This setting is recommended for security purposes, so
that you do not display application detail information to remote clients.
-->
<customErrors mode="Off"/>
<!-- AUTHENTICATION
This section sets the authentication policies of the application. Possible modes are "Windows",
"Forms", "Passport" and "None"
"None" No authentication is performed.
"Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to
its settings for the application. Anonymous access must be disabled in IIS.
"Forms" You provide a custom form (Web page) for users to enter their credentials, and then
you authenticate them in your application. A user credential token is stored in a cookie.
"Passport" Authentication is performed via a centralized authentication service provided
by Microsoft that offers a single logon and core profile services for member sites.
-->
<authentication mode="Windows"/>
<!-- AUTHORIZATION
This section sets the authorization policies of the application. You can allow or deny access
to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
(unauthenticated) users.
-->
<identity impersonate="true"/>
我尚未将应用程序部署到IIS。我正在运行该应用程序,方法是将项目设置为启动项目,然后将.asmx页面设置为设置开始页面。