我用以下代码启动了Inets http:
> inets:start(httpd, [{port, 8060}, {server_name, "myserver"},
> {server_root, "/Users/jonas/code"},
> {document_root, "/Users/jonas/code/mydocs"},
> {bind_address, {192, 168, 2, 5}}]).
{error,inets_not_started}
所以我唯一的错误信息是{error,inets_not_started}
。有没有办法让我得到更多关于哪里出错的信息?
4条答案
按热度按时间nkkqxpd91#
First, to solve your problem just start inets application (error reason indicates it is not started) by:
Second, in general starting SASL application improves a bit readability of Erlang/OTP errors/crashes - but it is not the case here.
z9zf31ra2#
您必须先呼叫
inets:start/0
。如需详细信息,请参阅the inets documentation。gijlo24d3#
启动(服务、服务配置、如何)-〉{确定、Pid}|{错误,原因}
所以你需要先调用这个函数。
启动()-〉启动(类型)-〉确定|{错误,原因}
类型:类型=永久|瞬变的|临时的
ioekq8ef4#
This is a great question because of the unfortunate overloading of the
inets:start/[0,1,2,3]
function and thehttpc
documentation isn't very clear that startinginets
will automatically start thehttpc
service as well.Especially when on simply jumps to the HTTP CLIENT SERVICE START/STOP section to get started quickly, thus missing the note in the module description.
inets:start/[0,1]
starts theinets
application itself and thehttpc
service with the default profile calleddefault
(this is only documented inhttpc
).inets:start/[2,3]
(which should be calledstart_service
) starts one of the services that can run atopinets
(viz.ftpc
,tftp
,httpc
,httpd
) once theinets
application has already started.start() ->
start(Type) -> ok | {error, Reason}
Starts the Inets application.
start(Service, ServiceConfig) -> {ok, Pid} | {error, Reason}
start(Service, ServiceConfig, How) -> {ok, Pid} | {error, Reason}
Dynamically starts an Inets service after the Inets application has been started
(with
inets:start/[0,1]
).Note regarding
httpc
From the top of the
httpc
module documentation :When starting the Inets application, a manager process for the default profile is started. The functions in this API that do not explicitly use a profile accesses the default profile.
That is, the
httpc
service will automatically get started using the default profile calleddefault
.Interestingly, when using a non-existing profile, the error message is
inets_not_started
: