Perl Mojolicious IIS路由转到POST方法

时间:2017-06-28 19:32:21

标签: perl iis routes mojolicious mojolicious-lite

在这里,我有一个Mojolicious应用程序,在morbo服务器上运行时有效。当我在IIS中运行它似乎工作,但当你提交任何表单时,它就像IIS不确定哪条路由是GET或POST方法。

所以目前我的路线看起来像

my $authorized = $r->under('/conditions_form')->to('Account#is_logged_in');
  $authorized->get('/')->name('beach_conditions_form')->to('form#show_beach_conditions_form');
  $authorized->post('/')->name('submit_conditions')->to('form#submit_beach_conditions');

当我的表单完成并提交后,它应该重定向回到这样的表单

$self->redirect_to('beach_conditions_form');

这是我收到错误的时候! 错误与

一致
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "[Wed Jun 28 15:26:22 2017] [debug] Reading configuration file "D:\inetpub\wwwroot\beach_conditions\beach_conditions.conf" [Wed Jun 28 15:26:22 2017] [debug] POST "/conditions_form" [Wed Jun 28 15:26:22 2017] [debug] Routing to controller "BeachConditions::Controller::Account" and action "is_logged_in" [Wed Jun 28 15:26:22 2017] [debug] Routing to controller "BeachConditions::Controller::Form" and action "submit_beach_conditions" [Wed Jun 28 15:26:22 2017] [error] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'OBS_DT', table 'BeachSafety.dbo.BEACH_CONDITIONS'; column does not allow nulls. INSERT fails. (SQL-23000) [state was 23000 now 01000] [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated. (SQL-01000) [for Statement "INSERT INTO BEACH_CONDITIONS ( beach_current, flag_color, note, obs_dt, obs_loc, rip_current_risk, water_temp, wave_height, wave_type, weather, wind_direction, wind_speed) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) SELECT SCOPE_IDENTITY()" with ParamValues: 1=undef, 2=undef, 3=undef, 4=undef, 5=undef, 6=undef, 7=undef, 8=undef, 9=undef, 10=undef, 11=undef, 12=undef] 

对我来说,这意味着它只是跳过GET方法并直接进入POST ....

如果我对路径进行硬编码,一切都很好(但一切都不好,因为它的硬编码......)。

这有效..

$self->redirect_to('http://server/beach_conditions/beach_conditions.pl/conditions_form');

我找到了这个,但帮助不大。

https://groups.google.com/forum/#!topic/mojolicious/IPJopdGCdKQ

感谢您提供任何信息。

1 个答案:

答案 0 :(得分:0)

好的,所以@simbabque是对的,你可以完全托管IIS。

我刚启动了类似

的脚本
Mojolicious::Commands->start_app('BeachConditions', 'daemon', '-l', 'http://*:8080');

现在它是可访问的,您所做的就是运行启动脚本。

这让我想到了一个我要发布的新问题。 那你如何运行多个应用程序呢?