错误在webconfig文件窗口模拟code [英] Error with windows impersonation code in webconfig file

查看:434
本文介绍了错误在webconfig文件窗口模拟code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在webconfig文件中声明,允许模拟以下部分,我的共享文件夹到其他机器

在网络内的公共访问

 <&的System.Web GT;
    <编译调试=真targetFramework =4.0/>
    <身份验证模式=窗口/>
    <身份冒充=真的userName =******密码=*****/>.........
..........

当我运行应用程序的投掷的错误说法。

配置错误
说明:该请求提供服务所需的配置文件的处理过程中发生错误。请检查下面的特定错误详细信息并适当地修改配置文件。

分析器错误信息:无法从配置文件中指定的凭据创建Windows用户令牌。从操作系统的登录失败错误:未知的用户名或密码错误

aspx页面:
我有样的aspx页面,我有以下code键移动从本地计算机的文件
到网络中的其它机器,其通过模拟运行

 保护无效的Page_Load(对象发件人,EventArgs的发送)
 {
 File.Copy(@C:\\ TEMP \\ CloudURL.txt,@\\\\ RemoteMachine \\ D $ \\ TEMP \\ CloudURL.txt,真正的);
}


解决方案

这是我做过什么来解决这个问题。我希望这会帮助别人。

我运行Windows 8.1和IIS 7和我有同样的消息作为作者。

以上是我遵循的步骤来解决这一问题:

1)如果在Windows中尚未设置,设置帐户的密码,使其与信息匹配有在web.config文件

转到PC设置 - >账户 - >登录选项,并设置密码

2)在IIS Windows功能添加Windows身份验证

a)右键单击Windows徽标在左下角

b)单击控制面板

c)点击程序

d)单击启用Windows功能打开或关闭

e)根据Internet信息服务 - >万维网服务 - >安全,勾选Windows身份验证

3)重新启动计算机

4)在IIS管理器,在IIS组中,单击身份验证

5)确保ASP.Net模拟和Windows身份验证'的状态是启用

6)重新启动计算机,然后重新运行该解决方案

另外,还要确保你的web.config冒充行包含域这样的:

<身份冒充=真的userName =域\\用户密码=密码/>

I have the following section declared in the webconfig file to allow impersonation , I have shared the folder to public access within the network on the other machine

<system.web>
    <compilation debug="true" targetFramework="4.0" />
    <authentication mode="Windows"/>
    <identity impersonate="true" userName="******" password="*****"/>

.........
..........

when i run the application its throwing error saying

Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'Logon failure: unknown user name or bad password.

Aspx page: I have sample aspx page where i have the following code to move the file from local machine to other machine in the network, which runs through impersonation

protected void Page_Load(object sender, EventArgs e)
 {
 File.Copy(@"C:\temp\CloudURL.txt", @"\\RemoteMachine\D$\temp\CloudURL.txt", true);
}    

解决方案

This is what I did to solve this issue. I hope it will help someone.

I'm running Windows 8.1 and IIS 7 and I had the same message as the author.

These are the steps I followed to solve the issue :

1) If not already set in Windows, set the password for the account to make it match with the information there is in the web.config file

Go to PC settings -> Accounts -> Sign In option and set your password

2) Add Windows authentication in IIS Windows feature

a) Right click on the Windows logo in the bottom left corner

b) Click 'Control panel'

c) Click 'Programs'

d) Click 'Turn Windows features on or off'

e) Under 'Internet Information Services' -> 'World Wide Web Services' -> 'Security', check 'Windows Authentication'

3) Restart the computer

4) In IIS Manager, in the 'IIS' group, click on 'Authentication'

5) Make sure the status of 'ASP.Net Impersonation' and 'Windows Authentication' are Enabled

6) Restart the computer and re-run the solution

Also make sure that your web.config impersonate line contains the Domain like this :

<identity impersonate="true" userName="Domain\user" password="password" />

这篇关于错误在webconfig文件窗口模拟code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆