通过 WCF 验证 ASP.Net 自定义 MembershipUser 会导致未经请求的服务调用吗?

发布于 2024-09-09 22:17:34 字数 946 浏览 4 评论 0原文

好吧,……首先是事实。

我正在开发一个 ASP.Net 项目,该项目通过 WCF 服务验证其用户。我在共享程序集中有一个 CutomMembershipUser 类,它继承自 MembershipUser,因为我使用的是自定义成员资格提供程序。这一切都无法改变,因为这不属于我的职权范围。

大致情况如下。我在登录控件的 Logged_In 事件中有一些代码,如下所示...

            CustomMembershipUser user = (CustomMembershipUser)SecurityBL.GetUser(userName);

            if (user.Customer.ToLower() == "some user")
            {
                //impl omitted
            }

第一行执行没有问题,我从服务中返回了正确的用户。但是,在第二行中,当我比较 user.Customer 属性时,第二个请求将发送到带有空 userName 字符串的服务,该字符串使整个 IDE 挂起大约 30秒左右,最终抛出一个 FaultException 我可以在服务端捕获它。

显然,我的第一个假设是该属性的 getter 中有一些延迟加载该属性的逻辑,但事实并非如此;事实上,它是一个自动实现的属性!

比这更奇怪的是,..在调用代码中,我什至无法捕获异常,该异常告诉我该请求来自与我正在执行的线程不同的线程。

对该对象的任何属性访问都会发生同样的问题,无论该对象是被覆盖的还是全新的。

以前有人见过这样的事情吗?我已经挠头两天了,不知道下一步该尝试什么。

任何帮助都会很棒。

提前致谢。 刺激8d

Okay,...first the facts.

I'm working on an ASP.Net project which validates it's users across a WCF service. I have a CutomMembershipUser class in a shared assembly which inherits from MembershipUser since I'm using a custom membership provider. All this cannot change because it's out of my remit.

Here's roughly what's happening. I've got some code in the Logged_In event of a login control that looks like this...

            CustomMembershipUser user = (CustomMembershipUser)SecurityBL.GetUser(userName);

            if (user.Customer.ToLower() == "some user")
            {
                //impl omitted
            }

The first line executes without problems and I get the correct user back from the service. However, in the second line, when I compare the user.Customer property a second request is sent to the service with an empty userName string which hangs the whole IDE for about 30 secnods or so and eventually throws a FaultException<T> which I can catch on the service side.

Obviously my first assumption was that there was some logic in the getter of that property that lazy loads the property but there isn't; in fact it's an auto implemented property!

Even more strange than that,..in the calling code I can't even catch the exception which tells me that the request is coming from a different thread than that which I'm executing.

This same problem happens for any property access on this object whether it's overridden or entirely new.

Has anyone seen anything like this before? I'v been scratching my head for 2 days now and I'm not sure what to try next.

Any help would be great.

Thanks in advance.
Stimul8d

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云之铃。 2024-09-16 22:17:34

成员资格非常简单,实际上不了解网络通信,尤其是 WCF,因此您的代码中一定发生了一些奇怪的事情。真的。

如果您想尝试隔离重现效果的最小占用空间的代码并将其上传到某个地方,我很乐意看一下。

membership is pretty straight ahead and actually has no knowledge of network communications especially not WCF,, so there has to be something hinky happening in your code. really.

if you want to try and isolate the smallest footprint of code that reproduces the effect and upload it somewhere I would be happy to take a look.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文