在服务器上部署后,Silverlight WCF服务不从数据库返回任何数据 [英] Silverlight WCF services not returning any data from database, after deploying on server

查看:87
本文介绍了在服务器上部署后,Silverlight WCF服务不从数据库返回任何数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个silverlight应用程序,只需单击一个按钮,即可使用wcf服务从数据库(SQL Server)读取数据,而无需使用实体框架。我部署在我的本地系统上,它工作正常。同样我在服务器上部署并发布它。我打开页面并单击按钮以获取数据。但它不显示数据,也不显示任何错误。我很困惑可能是什么问题,在哪一方。

I have one silverlight application that reads the data from the database(SQL Server) using wcf services without using entity framework, on a click of a button. I deployed on my local system and it works fine. The same i deployed on the server and published it. I opened the page and clicked the button to get the data. But it doesn't display the data, also do not display any error. I am confused as to what could be the issue, on which side.

推荐答案

您是否更改了服务器上的连接字符串。您可以尝试使用Fiddler测试您的应用是否成为来自服务器的数据。



祝您好运!
Have you changed your connection string on server. You can try to test if your app becomes data from server using Fiddler.

Good luck!


您的问题可以有很多原因:



1)由于跨域问题,Silverlight应用程序无法访问WCF服务。



请阅读:跨域边界提供服务: https://msdn.microsoft.com/en-us/library/cc197955%28VS.95%29.aspx [ ^ ]



2)由于缺少权限,WCF服务无法访问您的SQL服务器



在IIS中运行的应用程序(您的WCF服务!)
运行时如此 - 称为应用程序池标识。

这是默认值。



请阅读:

http://www.iis.net/learn/manage/configuring-security/application-pool-identities [ ^ ]



如果你在本地系统上运行你的应用程序

一切都在当前登录用户运行,那就是你。

在生产系统上,你的WCF服务运行一个应用程序池标识

可能是IIS AppPool \DefaultAppPool。



通过使用SQL Server Management Studio,您必须授予此用户访问权限数据库。



此外,在WCF服务中使用异常处理是个好主意。

本文介绍如何执行此操作:

WCF中的异常处理 [ ^ ]

这将允许您查找数据库访问期间发生的错误。
Your problem can have many reasons:

1) The Silverlight application cannot access the WCF service due to a cross domain issue.

Please read this: Making a Service Available Across Domain Boundaries: https://msdn.microsoft.com/en-us/library/cc197955%28VS.95%29.aspx[^]

2) The WCF service cannot access your SQL server due to missing rights

An application (your WCF service!) running in IIS
runs with a so-called Application-Pool Identity.
This is the default.

Please read:
http://www.iis.net/learn/manage/configuring-security/application-pool-identities[^]

If you run your application on your local system
everything runs with the currently logged on user and that is you.
On the productive system your WCF service runs with an application pool identity
probably "IIS AppPool\DefaultAppPool".

By using SQL Server Management Studio you must grant this user access to your database.

Moreover it is a good idea to use exception handling in your WCF service.
This article shows you how to do it:
Exception Handling in WCF[^]
This will allow you to find errors occurring during database access.


这篇关于在服务器上部署后,Silverlight WCF服务不从数据库返回任何数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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