最新想试试D语言,于是测试了下hunt框架,但是出现问题,具体如下
clone hunt-skeleton 后配置没有任何修改,增加了个
@Action
string ping(){
return "ping";
}
由于下载不了3.0的包,dub.sdl改为
name "hunt-skeleton"
description "An application based on Hunt Framework."
homepage "https://www.huntlabs.net"
copyright "Copyright (c) 2015-2020 HuntLabs"
license "Apache-2.0"
dependency "hunt" version="~>1.4.7"
dependency "hunt-framework" version="~>2.2.11"
targetType "executable"
路由
#
# [GET,POST,PUT...] path controller.method
#
GET / index.index
GET /ping index.ping
正常启动
D:\Programming\D\hunt-skeleton>D:\Programming\D\hunt-skeleton\hunt-skeleton.exe
2020-03-17 23:12:11 (10352) [warning] setConfig - The database is disabled. - C:\Users\xxxx\AppData\Local\dub\packages\hunt-framework-2.2.11\hunt-framework\source\hunt\framework\application\Application.d:249
___ ___ ___ ___ ________ _________
|\ \|\ \ |\ \|\ \ |\ ___ \ |\___ ___\ Hunt Framework 2.2.9
\ \ \\\ \ \ \ \\\ \ \ \ \\ \ \ \|___ \ \_|
\ \ __ \ \ \ \\\ \ \ \ \\ \ \ \ \ \ Listening: 0.0.0.0:8080
\ \ \ \ \ \ \ \\\ \ \ \ \\ \ \ \ \ \ TLS: Disabled
\ \__\ \__\ \ \_______\ \ \__\\ \__\ \ \__\
\|__|\|__| \|_______| \|__| \|__| \|__| https://www.huntframework.com
Try to browse http://0.0.0.0:8080
使用浏览器访问http://127.0.0.1:8080/ping正常返回ping文本
AB参数
ab -n 1000 -c 1000 http://127.0.0.1:8080/ping
崩溃后最后几行信息
2020-Mar-17 23:16:27.5624805 | 14752 | info | AbstractStream.onClose | socket closed: fd=3324 | C:\Users\xxxx\AppData\Local\dub\packages\hunt-1.4.7\hunt\source\hunt\io\channel\iocp\AbstractStream.d:99
2020-Mar-17 23:16:27.5624805 | 10156 | warning | AbstractSelector.doSelect | error occurred, code=1236, message: The network connection was aborted by the local system. | C:\Users\xxxx\AppData\Local\dub\packages\hunt-1.4.7\hunt\source\hunt\event\selector\IOCP.d:121
2020-Mar-17 23:16:27.5624805 | 12456 | info | AbstractStream.onClose | socket closed: fd=3096 | C:\Users\xxxx\AppData\Local\dub\packages\hunt-1.4.7\hunt\source\hunt\io\channel\iocp\AbstractStream.d:99
2020-Mar-17 23:16:27.5624805 | 10156 | info | AbstractStream.onClose | socket closed: fd=3204 | C:\Users\xxxx\AppData\Local\dub\packages\hunt-1.4.7\hunt\source\hunt\io\channel\iocp\AbstractStream.d:99
2020-Mar-17 23:16:27.5624805 | 10156 | warning | AbstractSelector.doSelect | error occurred, code=1236, message: The network connection was aborted by the local system. | C:\Users\xxxx\AppData\Local\dub\packages\hunt-1.4.7\hunt\source\hunt\event\selector\IOCP.d:121
2020-Mar-17 23:16:27.5624805 | 10156 | info | AbstractStream.onClose | socket closed: fd=3172 | C:\Users\xxxx\AppData\Local\dub\packages\hunt-1.4.7\hunt\source\hunt\io\channel\iocp\AbstractStream.d:99
AB上的信息
D:\DevTools\Apache24\bin>ab -n 1000 -c 1000 http://127.0.0.1:8080/ping
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Test aborted after 10 failures
apr_socket_connect(): 由于目标计算机积极拒绝,无法连接。 (730061)