IIS中托管的Silverlight应用程序无法访问数据库。 [英] Silverlight app hosted in IIS cannot access database.

查看:84
本文介绍了IIS中托管的Silverlight应用程序无法访问数据库。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的Silverlight登录应用程序,它使用WCF服务与我系统上的数据库(Mysql)进行交互。

我在IIS 7.5中托管了这个应用程序。我从我的系统浏览时运行正常。但是,当我在另一个系统(在同一个局域网内)打开应用程序时,主页面打开没有任何问题。当我尝试登录时,它不会抛出任何错误,但它无法打开子页面。



我对这件事情不太了解我不知道该怎么办。我正在寻找各种指导。如果有人有同样的问题并修好了,请告诉我。



提前致谢。 :)

解决方案

Silverlight应用程序可以在两种模式下运行,即浏览器内和浏览器外。在In-Browser中运行时(当您在IIS中的网站中托管它时),您无法直接访问数据库。浏览器内Silverlight应用程序通常以低权限运行。



您需要创建一个WCF服务来执行数据库查询,然后您的Silverlight应用程序必须与之通信WCF服务。



如果您使用的是Silverlight 5并且您的应用程序不公开,可以考虑启用提升信任: http://msdn.microsoft.com/en-us/library/gg192793(v = VS.95)的.aspx [ ^ ]


我做了一切rite端口也在防火墙上打开只有服务无法访问的东西。

挖掘出答案后我发现我做了以下更改。

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]



我的服务和适当的端点conf iguration。

I have a simple Silverlight Login application, which uses WCF services to interact with database(Mysql) on my system.
I hosted this app in IIS 7.5. It is running fine when I am browsing from my system. But when I open the application on another system (within same LAN) main page opens without any problem. When i try to login, it doesn't throw any error but it is unable to open open the child page.

I don't know much about this thing and i don't know what to do. I am looking for all sorts of guidance. If anybody had same problem and fixed it, please let me know.

Thanks in advance. :)

解决方案

Silverlight applications can run in two modes, In-Browser and Out-of-Browser. When running In-Browser (when you host it in a website in IIS), you cannot access a database directly. In-Browser Silverlight applications typically run with low-privilege.

You will need to create a WCF service to perform database queries and your Silverlight application will then have to communicate with the WCF service.

If you're using Silverlight 5 and your application is not public, perhaps consider enabling elevated trust: http://msdn.microsoft.com/en-us/library/gg192793(v=vs.95).aspx[^]


I did everything rite port was also open in firewall only thing was service was not accessible.
After digging for answers i figured out i did below changes.
[AspNetCompatibilityRequirements (RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

in my service and proper endpoint configuration.


这篇关于IIS中托管的Silverlight应用程序无法访问数据库。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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