启用 Silverlight 浏览器外会破坏浏览器内应用程序
我目前正在 Silverlight 中开发一个小型应用程序,最近为了尝试它,我为我的应用程序启用了浏览器外部署。但是,现在在我禁用该设置后,运行应用程序一旦完成加载就会抛出异常。
未处理的异常('silverlight 应用程序中的未处理错误 代码:4004 类别:托管运行时错误 消息:System.Reflection.TargetInitationException:操作期间发生异常,导致结果无效。
但是,如果我只是在浏览器中打开 TestPage.html,应用程序仍然可以正常工作。
有什么想法吗?谢谢
I am currently developing a small application in Silverlight, and recently to try it out, i enabled out-of-browser deployment for my application. However, now after I disabled the setting, running the application now throws an exception as soon as it finishes loading.
An unhandled exception ('Unhandled Error in silverlight application
Code: 4004
Category: ManagedRuntimeError
Message: System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid.
However, if I just open the TestPage.html in browser the application still works as it did.
Any ideas? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
例如,尝试在 App.Xaml.cs(App.Xaml 的代码隐藏)的 Application_UnhandledException 方法中输入以下行
“MessageBox.Show(e.ExceptionObject.Message);”。这可以让您了解当调试器尚未连接到浏览器时出了什么问题。购买方式,在 Visual Studio 中,您可以在调试菜单 -> 中手动将调试器附加到浏览器。例如,附加到进程...,然后选择类型为“Silverlight,x86”的进程。
For example, Try entering the following line in the Application_UnhandledException method of App.Xaml.cs (the code-behind of the App.Xaml)
"MessageBox.Show(e.ExceptionObject.Message);". This could give you an idea what goes wrong when the debugger is not yet attached the browser. Buy the way, In Visual Studio you can attach the debugger manually to your browser in the debug menu -> Attach to Process..., then choose the process with type "Silverlight, x86" for example.
我发现了问题。我不确定为什么激活浏览器外然后返回需要这样做,但将 ClientAccessPolicy.xml 文件添加到 .web 项目
解决了问题。
I found the problem. I'm not sure why activating out-of-browser and then going back required this, but adding a ClientAccessPolicy.xml file to the .web project
fixed the problem.