C# - 映射网络的Web服务驱动网络、Web

由网友(無心亦無情)分享简介:我们正在努力在具有运行第三方程序,与映射网络驱动器交互的Web服务。因此,我们有这个驱动编程方式从Web服务映射。We are working on a web service that has to run a 3rd party process that interacts with a mapped netwo...

我们正在努力在具有运行第三方程序,与映射网络驱动器交互的Web服务。因此,我们有这个驱动编程方式从Web服务映射。

We are working on a web service that has to run a 3rd party process that interacts with a mapped network drive. So we have to map this drive programmatically from the web service.

我已经结束了WNetAddConnection2,等在另一个项目一个更好的课,所以我扔了code正确。

I have already wrapped up WNetAddConnection2, etc. in a nicer class for another project, so I threw the code right in.

我们的网络服务是在UltiDev卡西尼(而不是IIS)的系统帐户下运行运行。我们得到的错误code表示:指定的设备名无效每次。我也试图冒充其他用户在web.config文件中,具有相同的结果。

Our web service is running under UltiDev Cassini (instead of IIS) which runs under the System account. We get the error code for: "the specified device name is invalid" every time. I also tried impersonating other users in the web.config file, with the same results.

当我跑我从一个控制台程序,code下普通用户帐户驱动器将映射就好了。

The drive will map just fine when I run my code from a console program under a normal user account.

我也曾尝试使用完全相同的结果WNetAddConnection。

I have also tried running the equivalent "net use" command from C# with the exact same results as WNetAddConnection.

有谁知道为什么Windows服务或系统的用户将无法映射网络驱动器?

Does anyone know why a windows service or System user wouldn't be able to map network drives?

有谁知道一个解决方法吗?简单地映射在系统启动时的驱动器将是一个解决方案,但如何能在系统/模拟用户访问它?

Does anyone know a workaround? Simply mapping the drive on system startup would be a solution, but how could the system/impersonated user access it?

链接的UltiDev卡西尼号: UltiDev

Link for UltiDev Cassini: UltiDev

解决方法:我设置UltiDev卡西尼服务在管理员登录和一切工作。按计划在ASP.NET的模拟不能正常工作。

SOLUTION: I set the UltiDev Cassini service to logon under Administrator and everything is working. The ASP .Net impersonation must not work as planned.

推荐答案

在LOCAL_SYSTEM帐户presents匿名的凭证。你可以使用UNC网络共享访问这些信息,提供匿名(每个人)可以访问共享。

The LOCAL_SYSTEM account presents Anonymous credentials on the network. You could use a UNC network share to access this information, provided that anonymous (Everyone) has access to the share.

您也可以安装卡西尼作为Windows服务,你可以配置到根据不同的用户运行。

You can also install Cassini as a windows service which you could configure to run under a different user.

阅读全文

相关推荐

最新文章