0
我使用了來自Miguel Grinberg的blog的小型瓶測試應用程序,並試圖將其部署到IIS上。它的工作原理我在那裏POST
請求正在本地系統上運行良好。當在IIS 7.5上部署應用程序時,Flask POST請求掛起
但是,當我將它部署到IIS 7.5(Windows Server 2008 R2 Datacenter版本)時發生問題。
我用這個post配置IIS。
然後,當我執行一個POST
請求到服務器我沒有得到迴應。
我的代碼:
from flask import Flask, jsonify
from flask import abort
from flask import make_response,request
app = Flask(__name__)
@app.errorhandler(404)
def not_found(error):
return make_response(jsonify({'error': 'Not found'}), 404)
@app.route('/dsebws', methods=['POST'])
def create_task():
d=request.data
tp= str(type(d))
return jsonify({'task': tp}), 201
if __name__ == '__main__':
app.run(debug=Tr
UE)使用python app.py
測試結果地方:
C:\Users\xyz>curl -v -X POST -d "Test" http://localhost:5000/dsebws
* About to connect() to localhost port 5000 (#0)
* Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 5000 (#0)
> POST /dsebws HTTP/1.1
> User-Agent: curl/7.28.1
> Host: localhost:5000
> Accept: */*
> Content-Length: 4
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 4 out of 4 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 201 CREATED
< Content-Type: application/json
< Content-Length: 28
< Server: Werkzeug/0.10.4 Python/2.7.9
< Date: Mon, 05 Oct 2015 00:30:54 GMT
<
{
"task": "<type 'str'>"
}* Closing connection #0
測試IIS服務器上:
PS C:\Users\tarik> curl -v -X POST -d "tarik" http://localhost:80/dsebws
* About to connect() to localhost port 80 (#0)
* Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 80 (#0)
> POST /dsebws HTTP/1.1
> User-Agent: curl/7.28.1
> Host: localhost
> Accept: */*
> Content-Length: 5
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 5 out of 5 bytes
它掛在那兒。過了一段時間(15分鐘),我弄了半天HTML響應說,有關的超時。
請加上「東西」到您的文章。 –
試圖發送內容長度爲388的json ...但仍...同樣的問題,沒有回覆 –