自定义域服务失败但身份验证有效(Silverlight Biz 应用程序模板)
我在 IIS 服务器上托管一个 Silverlight 业务应用程序模板派生的应用程序。我正在使用内置的表单身份验证,它工作得很好。
不幸的是,我添加了一项具有特殊行为的附加服务。如果我远程访问服务器并使用该站点,一切都会按预期进行。如果我从另一台 PC 连接到该站点,身份验证仍然有效,但我的自定义域服务失败并出现以下错误:
IE 抛出此错误消息:
System.ServiceModel.DomainServices.Client.DomainOperationException: 查询加载操作失败 '得到___'。类型异常 'System.ServiceModel.DomainServices.Client.DomainOperationException' 被抛出了。
我尝试调试该过程并获得更多信息:
System.ServiceModel.DomainServices.Client.DomainOperationException: 查询加载操作失败 '得到___'。远程服务器返回 错误:未找到。 ---> System.ServiceModel.CommunicationException: ...
我的 clientaccesspolicy 和跨域策略位于 wwwroot 和网站的根目录中,如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*" />
<domain uri="http://*" />
<domain uri="https://*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
失败的域服务正在使用 ADO.NET 实体模型。其中的实体与用于身份验证的 aspnetdb 数据库相同,并且我已向 IIS 用户(和管理员,我绝望了)授予包含该 db 的 App_Data 文件夹的文件权限。
同样,如果在服务器上本地连接,所有服务都可以工作。远程连接时只有身份验证/注册服务有效。
我已经搜索了两天并尝试了我能找到的所有解决方案,但似乎无法使其正常工作。任何建议或指导将不胜感激。
I'm hosting a Silverlight Business Application Template derived application on an IIS Server. I'm using the built-in Forms Authentication which is working perfectly.
Unfortunately, I've added an additional service which has peculiar behavior. If I remote into the server and use the site everything works as expected. If I connect to the site from another PC, Authentication still works but my custom Domain Service is failing with the following error:
IE Throws this Error Message:
System.ServiceModel.DomainServices.Client.DomainOperationException:
Load operation failed for query
'Get___'. Exception of type
'System.ServiceModel.DomainServices.Client.DomainOperationException'
was thrown.
I tried debugging the process and get a little more information:
System.ServiceModel.DomainServices.Client.DomainOperationException:
Load operation failed for query
'Get___'. The remote server returned
an error:NotFound. --->
System.ServiceModel.CommunicationException:
...
My clientaccesspolicy and crossdomain policies are in both wwwroot and the root of the website and are the following:
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*" />
<domain uri="http://*" />
<domain uri="https://*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
The Domain Service that's failing is using an ADO.NET Entity Model. The entities of which are in the same the aspnetdb database that is used for authentication and I've granted file permissions for the IIS User (and Administrator, I got desperate) for the App_Data folder which contains the db.
Again, all services work if connecting locally on the server. Only the Auth/Registration services works when connecting remotely.
I've searched for two days and tried every solution I can find but can't seem to get it working. Any advice or direction would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然这对于您的项目来说已经很晚了,但它可能对其他人有帮助。听起来您在对底层数据库进行身份验证时遇到问题。您可能想了解数据库级别发生了哪些类型的模拟。
我遇到了类似的问题,事实证明,我正在尝试以 Sliverlight 客户端电脑帐户访问数据库,而该帐户在授权帐户中从未存在过(尽管我的身份验证工作正常,就像您的情况一样)。更改应用程序池标识为我解决了这个问题(我在加入域的 PC 上使用网络服务帐户,该域使用 Computer$ 帐户代表您登录)
当您遇到 CommunicationException 时,您确实想查看 InnerException ,它会告诉您真正的问题是什么?
如果没有任何内容,那么您需要在服务器端进行调试(逐步执行服务)以查看引发异常的原因。
如果在 WCF 服务器端引发异常并且未将异常包装到导致通道出现故障的故障中(至少在我有限的经验中是这样),则会发生 CommunicationException。
希望这对某人有帮助。
Although this is pretty late for your project but it might help somebody else. Sounds like you are having problem with authenticating to the underlying database. You may want to look into what sort of impersonations are happening at database level.
I had a similar problem, and it turned out that I was trying to access the database as Sliverlight client pc account which never existed in authorized accounts (although my authentication was working perfectly just like in your case). Changing the Application Pool Identity fixed it for me (I was using Network Service account on a PC joined to a domain which uses Computer$ account to login on your behalf)
When you run into CommunicationException, you really want to look at InnerException which will tell what is the real issue.
If there's nothing then you'll need to debug on server side (step through service) to see what is throwing the exception.
CommunicationException occurs if an Exception is thrown on WCF server side and not wrapped into a fault causing the channel to become faulted (in my limited experience at least).
Hope this helps somebody.
WCF 跟踪对我没有帮助!它给出了一条空消息。
最后,
对于我的情况,
我从方法中删除了 [RequiresAuthentication] 之类的属性
我从域服务类中删除了 [RequiresAuthentication](检查所有部分)
如果它在本地工作但在服务器上不起作用,则一定是配置问题。在我的例子中,我使用了
membership.ResetPassword()
函数,该函数在web.config
中被禁用为enablePasswordReset=false。除此之外,有些人说某些方法只能在 asp.net.compatibility 模式下调用。
希望能帮助别人。
WCF Tracing didn't help me! It gives an Empty message.
Finally,
FOR MY CASE,
I removed [RequiresAuthentication] like attributes from methods
I removed [RequiresAuthentication] from Domain Service Class (check all partials)
If it works on local but not on server it must be a configuration problem. In my case I used
membership.ResetPassword()
function which is disabled inweb.config
as enablePasswordReset=false.Beside this some people says some methods just invoke-able in asp.net.compatibility mode.
Hope helps someone else.