- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个 .NET 2.0 应用程序,我有兴趣将其移植到 Linux 上的 mod_mono 下运行。
应用程序的一部分是 XHR 代理,它提供对提供给前端的各种数据馈送的访问。这个代理脚本确保用户有一个有效的 session ,然后确保用户有权访问他们试图检索的数据。最后,如果请求,代理将使用 Newtonsoft 将 XML 转换为 JSON。
此服务的 URL 如下所示:
/ApiProxy.aspx?url=http%3A%2F%2Fexample%2Fapi%2Fservice
出于某种原因,我无法让这个软件在 mod_mono 下运行。它会产生以下错误:
System.Threading.ThreadAbortException
Thread was being aborted
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): mscorlib.
Exception stack trace:
at (wrapper managed-to-native) System.Threading.Thread:Abort_internal (System.Threading.InternalThread,object)
at System.Threading.Thread.Abort (System.Object stateInfo) [0x00000] in <filename unknown>:0
at System.Web.HttpResponse.End () [0x00000] in <filename unknown>:0
at ASP.apiproxy_aspx.__RenderTree (System.Web.UI.HtmlTextWriter __output, System.Web.UI.Control parameterContainer) [0x00000] in <filename unknown>:0
我真的不知道这个错误是怎么回事。
它似乎没有引用我的任何代码,也没有提供任何关于问题可能出在哪里的提示。我的一个线索是,有一些大块似乎与该问题有关:
using(SqlConnection con = new SqlConnection(myConnectionString))
{
con.Open();
//1) determine if the user is allowed to get the service
//2) retrieve the content the user is requesting
//3) convert the content to json
} catch (Exception ex){
throw new Exception("Unhandled exception", ex);
} finally {
if(con != null)
con.Close();
}
}
当我注释掉 try/catch/finally block 时,行为发生了一点变化,但最终结果仍然是错误。这次是裸露的 400 无效请求错误。
我真的不知道从哪里开始,所以我想我有两个问题:
最佳答案
最可能的原因是您在处理请求时超时。在 web.config 中增加超时,错误应该消失。
<location path="apiproxy.aspx">
<system.web>
<httpRuntime executionTimeout="180"/> <!-- set large value here -->
</system.web>
</location>
这里是单声道中HttpResponse.End ()
方法的代码https://github.com/mono/mono/blob/master/mcs/class/System.Web/System.Web/HttpResponse.cs#L631-L638
public void End ()
{
if (context == null)
return;
if (context.TimeoutPossible) {
Thread.CurrentThread.Abort (FlagEnd.Value);
} else {
关于c# - 在 mod_mono (3.12.1) 上运行的 XHR 代理中的 System.Threading.ThreadAbortException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29614517/
完成此任务的最佳方法是什么:主线程(线程 A)创建另外两个线程(线程 B 和线程 C)。线程 B 和 C 执行繁重的磁盘 I/O,最终需要将它们创建的资源传递给线程 A,然后调用外部 DLL 文件中的
我是一名对 Julia 语言感兴趣的新手程序员。文档( https://docs.julialang.org/en/v1/base/multi-threading/ )说 Threads.@threa
python中的thread.start_new_thread和threading.Thread.start有什么区别? 我注意到,当调用 start_new_thread 时,新线程会在调用线程终止
我正在学习安卓蓝牙编程。我从 Google 的 Android 开发者网站上复制了大部分代码以供学习。这个想法是监听服务器上的连接是在一个新线程中完成的,而不会阻塞 UI 线程。当收到连接请求时,连接
执行对象方法的线程是否依赖于创建它的线程上的线程? 假设您的 java 应用程序中有两个线程 Thread1 和 Thread2,以及两个类 ClassA 和 ClassB。 您在 Thread1 上
我正在用这段代码测试 C++11 线程,但是在创建线程时,我遇到了错误没有匹配函数调用 'std::thread::thread()'. 这就像我给 std::thread ctr 的函数有什么问题,
我有如下类 eventEngine 和网关: class eventEngine { public: eventEngine(); std::thread threa; std
我需要运行与列表 dirlist 中的元素一样多的 Observer 类线程。当我运行它 python 控制台时,它可以正常工作。 class Observer(Thread): def ru
我在一本 Java 书中读到了下面的代码。我知道主类默认继承 Thread 类,所以 currentThread();而不是 Thread.currentThread();也会做这项工作。 但我不明白
我在我的系统中使用第 3 方 API,该 API 启动一个永久运行的用户线程。一旦我的程序结束,JVM 由于该线程而继续运行,因此我尝试获取此线程引用并通过更改它 thread.setDaemon(t
我所知道的 Python 中的每个对象都可以通过调用来处理其基类初始化: super(BaseClass, self).__init__() threading.Thread 的子类似乎不是这种情况,
在我最近从事的 Xamarin 项目中,我可以看到开发人员使用了 Java.Lang.Thread 以及 System.Threading.Thread(用于非常相似的操作 - 例如在后台加载数据)。
我在 Julia 中运行双循环。代码非常简单。 w = rand(1000,1000) function regular_demo(w::Array{Float64, 2}) n = size
我在 Windows 上使用 Python 3。我正在使用 threading.Thread动态运行一个函数,我可以带参数或不带参数调用它。我正在设置一个列表,其中的第一项是定义路径的字符串。其他参数
我遇到了一些使用线程模块(使用 Python 2.6)管理线程的示例。 我想了解的是这个例子是如何调用“运行”方法的,在哪里调用的。我在任何地方都看不到它。 ThreadUrl 类在 main() 函
假设我从 threading.Thread 派生: from threading import Thread class Worker(Thread): def start(self):
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
使用 WinDbg 和 SOS,我有以下内容: 0:011> !threads ThreadCount: 7 UnstartedThread: 0 BackgroundThread: 4 Pendin
App Engine 给出错误: com.google.apphosting.api.ApiProxy$CallNotFoundException: Can't make API call urlfe
我正在尝试将 Swing JEditorPane 嵌入到 JavaFX 项目中,如下代码所示。 Platform.runLater(() -> { SyntaxTester ob = new
我是一名优秀的程序员,十分优秀!