WNetAddConnection2在Windows 2008 R2中不起作用 [英] WNetAddConnection2 does not work from Windows 2008 R2

查看:60
本文介绍了WNetAddConnection2在Windows 2008 R2中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用WNetAddConnection2通过ASP.NET Web应用程序连接到网络位置.当我使用随VS2010一起提供的ASP.NET开发服务器进行调试时,一切都可以正常工作.但是,当我在Windows Server 2008 R2中部署代码时,它不会放置文件并抛出Win32异常,错误代码为0X80004005.该应用程序池标识是网络服务,我正在使用域用户帐户进行注入.

I am trying to connect to a network location through my ASP.NET web application using WNetAddConnection2. Every thing works perfectly when I debug it using the ASP.NET Development Server provided along with VS2010. But when I deploy the code in a Windows Server 2008 R2 it does not place the file and throws a Win32 exception with error code 0X80004005. The application pool identity is network service and i am using a domain user account for imparsanation.

我已经使用命令检查了连接性和用户名密码的有效性,并且可以从服务器运行方式/netonly/user:DOMAIN \ User"explorer.exe \ Path"正常运行

I have checked the connectivity and user name password validity using the command and it works pefectly from the server runas /netonly /user:DOMAIN\User "explorer.exe \Path"

还请注意,我的防火墙已关闭,并且Windows Server 2008上没有运行防病毒软件.

Please also note my firewall is switched off and i dont have an antivirus running on the Windows Server 2008.

我们非常感谢您的帮助.

Any help is really appreciated.

我使用了推荐答案

WNetUseConnection将起作用,我们需要正确定义其所有结构.WNetUseConnection(IntPtr.Zero,nr,password,username,0,null,null,null);

The WNetUseConnection will work, we need to define all its structures properly. WNetUseConnection(IntPtr.Zero, nr, password, username, 0, null, null, null);

这篇关于WNetAddConnection2在Windows 2008 R2中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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