1

我们开始吧,我有一个 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

感谢您提供任何信息。

4

1 回答 1

0

好的,所以@simbabque 是对的,您可以完全独立于 IIS 托管。

我刚刚使我的启动脚本类似于

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

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

这给我带来了一个我将发布的新问题。那么如何运行多个应用程序呢?

于 2017-06-30T20:17:38.717 回答