在 XBAP 中刻录 CD

发布于 2024-09-17 08:53:25 字数 567 浏览 3 评论 0原文

我有一个 XBAP,需要能够刻录 CD。从 Visual Studio 内部运行时,一切正常。但是,当从浏览器运行时,IMAPI dll 一旦尝试访问驱动器就会报告该环境不受支持。

我假设这归结于许可。我有一个已安装的签名证书,并且 xbap 设置为作为完全信任应用程序运行(尽管我猜测它不可能,或者我不会遇到此问题)。

目前,这一切都在我的本地计算机上运行,​​但最终我希望将其部署到 Web 服务器(所有用户都已在其客户端上安装了证书)。

有人对我错过了什么/做错了什么有任何想法吗?

更新:

我尝试创建一个新的测试证书,将其安装在证书存储中,然后对其签署 XBAP,但这没有什么区别。

如果有人有的话,真的可以提供一些想法吗?

进一步更新:

我创建了一个能够刻录 CD 的控制台应用程序。 Shell 到这个控制台应用程序允许我从我的 xbap 刻录 CD,但不能从 xbap 本身内部刻录。

然而,这确实不是我想要的。理想情况下,我希望将所有这些都包含在 xbap 中。如果做不到这一点,是否有办法将控制台应用程序包含在 xbap 的一键部署中?

谢谢

I have an XBAP that needs to be able to burn cd's. When running from inside Visual Studio, everything works okay. However when running from a browser, the IMAPI dll reports that the environment is not supported as soon as it tries to access the drive.

I am assuming this is coming down to permissioning. I have a signed certificate which I have installed and the xbap is set to run as a full trust application (although I'm guessing that it can't be or I wouldn't be having this problem).

Currently this is all running on my local machine, however eventually I want this to be deployed to a web server (all users will already have the certificate installed on their clients).

Does anyone have any ideas as to what I've missed / done wrong?

Update:

I have tried creating a new, test certificate which I've installed in my certificate store and then signed the XBAP against it, but it makes no difference.

Really could do with some ideas if anyone has any?

Further Update:

I have created a console application which is able to burn cd's. Shelling out to this console application allows me to burn the cd from my xbap, but not from inside the xbap itself.

However, this is really not what I want. Ideally I want to have all this contained within the xbap. Failing that, is there a way to include the console application in the xbap's one click deployment?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一抹微笑 2024-09-24 08:53:25

我相信这对于 XBAP 来说是不可能的。根据 有关 XBAP 的 MS 文档

不可用的权限示例
在互联网区:

  • FileIOPermission - 此权限控制在磁盘上读取和写入文件的能力。因此,Internet 区域中的应用程序无法读取用户硬盘上的文件。

  • RegistryPermission - 此权限控制读/写注册表的能力。因此,Internet 区域中的应用程序无法访问或控制用户注册表中的状态。

  • SecurityPermission.UnmanagedCode - 此权限控制调用本机 Win32 函数的能力。

当您通过 Internet 运行 XBAP 时,您将遇到问题 #3:尝试与非托管代码进行互操作。

我建议使用 ClickOnce 将您的应用程序部署为独立应用程序。这样,您就可以完全访问系统,但仍然可以像使用 XBAP 一样轻松部署和升级。


*编辑*

您可以尝试一件事 - 我不能保证它会起作用 - 但您可以让您的用户进入 IE Internet 选项,添加您的网站到受信任的站点列表。我敢打赌,您的 CD 刻录代码将会起作用,因为它将位于受信任区域,而不是 Internet 区域。

I believe this is not possible to do with XBAP. According to MS documentation on XBAPs,

Examples of permissions not available
in the Internet zone:

  • FileIOPermission - This permission controls the ability to read and write files on disk. Consequently, applications in the Internet zone cannot read files on the user's hard disk.

  • RegistryPermission - This permission controls the ability to read/write to the registry. Consequently, applications in the Internet zone cannot access or control state in the user's registry.

  • SecurityPermission.UnmanagedCode - This permission controls the ability to call native Win32 functions.

When you run your XBAP over the internet, you'll hit issue #3: trying to interop with unmanaged code.

I would recommend deploying your app as a stand-alone app with ClickOnce. That way, you can have full access to the system, but still get easy deployment and upgrades like you do with XBAP.


*edit*

One thing you could try -- and I can't guarantee it will work -- but you could have your users go into IE Internet Options, add your site to the trusted sites list. I'm betting then your CD burning code will work because it will be in the trusted zone, rather than the Internet Zone.

不顾 2024-09-24 08:53:25

尝试转到

HKLM\SOFTWARE\Microsoft.NETFramework\Windows Presentation Foundation\Hosting

注册表中的

创建一个名为 RunUnrestricted 且值为 1 的新 DWORD。

Try going to

HKLM\SOFTWARE\Microsoft.NETFramework\Windows Presentation Foundation\Hosting

in the registry

create a new DWORD named RunUnrestricted with value 1.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文