Csharp异步调用调用C ++ :: blocking问题的Web Service [英] Csharp async calls to Web Service that calls C++ :: blocking issue

查看:98
本文介绍了Csharp异步调用调用C ++ :: blocking问题的Web Service的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我继承了一个C ++ DLL,我需要多次远程调用

异步。我开发的是:


CSharp Web应用程序,它对CSharp Web进行异步调用

服务。 Web服务调用DLL,它执行一些重的

处理,然后将结果发送回CSharp Web应用程序。


问题是调用到Web服务中的DLL相互阻止

。如果我向Web服务发送10个异步请求,调试

语句显示它们都在1/10
$秒内到达DLL的调用,但只有一个调用C ++ DLL中的main方法将在

a时运行。如果我将对DLL的调用取而代之并将其替换为类似15秒睡眠的内容,那么异步Web服务将按预期异步调用所有进程




有没有一个固有的原因,为什么DLL不允许多次调用

它的主要方法同时运行?有没有人建议为什么会发生这种情况?


-BEP

I inherited a C++ DLL that I need to remotely call multiple times
asynchronously. What I have developed is:

CSharp web application that makes asynchronous calls to a CSharp Web
Service. The Web Service calls the DLL, which does some heavy
processing, then sends the results back to the CSharp web application.

The problem is that the calls to the DLL in the Web Service are blocking
each other. If I send 10 async requests to the Web Service, debug
statements show that they all reach the call to the DLL within 1/10 of a
second, but only one call to the main method in the C++ DLL will run at
a time. If I stub off the call to the DLL and replace it with something
like a 15 second Sleep, the async Web Service calls all process
asynchronously as expected.

Is there an inherent reason why the DLL won''t allow multiple calls to
its main method to run concurrently? Does anyone have a suggestion as
to why this is happening?

-BEP

推荐答案

如果你有DLL的源代码,请确保你的方法是你的b $ b $不同步。


另外,如果DLL有一个方法可以调用另一个同步的另一个DLL,你会看到相同的效果。


你是描述同步行为,以便我说出原因是什么。


Brian Parker写道:
If you have the source code to the DLL, make sure the methods you''re
calling aren''t synchronized.

also, if the DLL has a method that calls another DLL somewhere that is
synchronized, you''ll see the same effect.

You''re describing synchronous behavior, so that what I''d say the cause is.

Brian Parker wrote:
我继承了一个我需要远程的C ++ DLL多次调用
异步。我开发的是:

CSharp Web应用程序,它对CSharp Web服务进行异步调用。 Web服务调用DLL,它执行一些繁重的处理,然后将结果发送回CSharp Web应用程序。

问题是在Web服务中调用DLL是相互阻挡。如果我向Web服务发送10个异步请求,调试
语句显示它们都在1/10秒内到达DLL的调用,但只有一个调用C ++中的main方法它将在
运行一次。如果我将对DLL的调用取而代之并将其替换为类似15秒睡眠的内容,则异步Web服务会按预期异步调用所有进程。

是否存在DLL为什么不允许多次调用它的主要方法并发运行的固有原因?有没有人建议为什么会发生这种情况?

-BEP
I inherited a C++ DLL that I need to remotely call multiple times
asynchronously. What I have developed is:

CSharp web application that makes asynchronous calls to a CSharp Web
Service. The Web Service calls the DLL, which does some heavy
processing, then sends the results back to the CSharp web application.

The problem is that the calls to the DLL in the Web Service are blocking
each other. If I send 10 async requests to the Web Service, debug
statements show that they all reach the call to the DLL within 1/10 of a
second, but only one call to the main method in the C++ DLL will run at
a time. If I stub off the call to the DLL and replace it with something
like a 15 second Sleep, the async Web Service calls all process
asynchronously as expected.

Is there an inherent reason why the DLL won''t allow multiple calls to
its main method to run concurrently? Does anyone have a suggestion as
to why this is happening?

-BEP



如果DLL正在处理使用任何线程安全的对象,并且由于某种原因,他们碰巧尝试访问同一个对象(也许

在DLL中所有线程将共享的静态内容)然后

他们可能会一次执行一个,因为他们带着他们转向

对象。

If the DLL is dealing with any objects that are thread safe, and they
happen to try and access the same object for some reason(perhaps
something static in the DLL that all threads would be sharing) then
they will likely execute one at a time as they take they''re turn with
the object.


编写的DLL是什么版本的C ++?

What version of C++ is the DLL written in?


这篇关于Csharp异步调用调用C ++ :: blocking问题的Web Service的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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