Using Native dlls in C# Com wrapper and Use dll in silverlight

吃可爱长大的小学妹 提交于 2019-12-12 13:28:05

问题


As part of my project I need to use some Unamanged code dlls in Silverlight. If I wrap these unmanaged dlls in a C# dll will I be able to access the native dlls from silverlight. I use Visual Studio 2010 and Silverlight 4.0


回答1:


With Silverlight 4, you can call out to COM objects installed on the local machine. However to do this the user has to choose to allow the Silverlight App full access to their machine.

In addition the COM object needs to already be installed on the machine. Therefore the user would first have to separately download and install your DLLs before using any features that relied on them in your Silverlight application.




回答2:


Silverlight runs in the browser sandbox so it wont allow you to call directly to unmanaged assembly. Eventhough you wrap the unmanaged code in a C# assembly, it still get loaded within the same app domain that is restricted by the same security restriction.

I have read that you can use html interoperability between silverlight and ActiveX, but I haven't experienced it myself. Alternatively, you can deploy the complete WPF application and if you sign it with appropriate certificate and security setting, it can access unmanaged code - if this is an option.



来源:https://stackoverflow.com/questions/2370880/using-native-dlls-in-c-sharp-com-wrapper-and-use-dll-in-silverlight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!