上文说到flask 可以通过wfastcgi.py 部署到iis 中,但我的项目必须使用arcpy, 不好使用linux平台,又由于其中flask 与arcpy的交互诡异问题,不得不采用外部调用 xxx.py文件方式获取结果

所以才有了使用subprocess.check_output方式调用

但在测试中发现单独的check_output 正常输出,在flask接口中却返回 500 服务器内部错误。多方查证,可能的原因是iis_user对cmd.exe 的权限不足,但几次设置文件夹权限之后仍无济于事。难道本身IIS 因安全问题限制此种方式调用?

待查证。

flask在 iis中使用subprocess.check_output问题

 

 

#coding:utf-8
import os
import arcpy
import time
import random
import sys
from arcpy import env

print('start')
gdb = r'E:\test-data\data2.gdb' #str(sys.argv[1])

arcpy.ClearWorkspaceCache_management()
arcpy.env.workspace=gdb
fc = arcpy.ListFeatureClasses()
for f in fc:
    print(f)
print('over')
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-24
猜你喜欢
  • 2022-12-23
  • 2021-08-17
  • 2021-10-06
  • 2021-05-28
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
相关资源
相似解决方案