C# python项目没有';t由SSRS用户运行,但在我的用户上运行良好
我开发了一个ssrs数据源扩展(c#.NET 4.0) 它在我的报表设计器上工作,但在服务器上无法执行相同的操作。 该错误发生在IDbConnection的open()实现中。 my open用数据填充数据库表 然后创建一个批处理文件,该文件运行一个python组件,该组件分析该表,并将结果放入另一个数据库表中。 填写表格的第一部分运行良好。 然后创建批处理。它正在运行,在python代码中的某个点上它崩溃了,我无法捕获任何异常(根本不是python专家,使用它是因为它是开源的,完全满足了我的需要) 以下是在.NET端创建和运行批处理文件的方法:C# python项目没有';t由SSRS用户运行,但在我的用户上运行良好,c#,python,reporting-services,C#,Python,Reporting Services,我开发了一个ssrs数据源扩展(c#.NET 4.0) 它在我的报表设计器上工作,但在服务器上无法执行相同的操作。 该错误发生在IDbConnection的open()实现中。 my open用数据填充数据库表 然后创建一个批处理文件,该文件运行一个python组件,该组件分析该表,并将结果放入另一个数据库表中。 填写表格的第一部分运行良好。 然后创建批处理。它正在运行,在python代码中的某个点上它崩溃了,我无法捕获任何异常(根本不是python专家,使用它是因为它是开源的,完全满足了我的需
static void mybatchexecution(int uniqueiteration)
{
string batchfilename = @"C:\CoverageTemp\Coverage_" + uniqueiteration+".bat";
StreamWriter sw = new StreamWriter(batchfilename);
string batchcmd = @"F:\Python27\python.exe F:\CoverageProject\CoverageGrowth.py " + uniqueiteration;
sw.WriteLine(batchcmd);
sw.Close();
try
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = batchfilename;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardOutput = true;
startInfo.LoadUserProfile = true;
//this i already tried
//startInfo.UserName = @"domain\user";
//SecureString passWordObj = new SecureString();
//foreach (Char C in "pass".ToCharArray())
// passWordObj.AppendChar(C);
//startInfo.Password = passWordObj;
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
Process childProcess = new Process();
childProcess.StartInfo = startInfo;
childProcess.Start();
string t=childProcess.StandardOutput.ReadToEnd();
childProcess.WaitForExit();
string logfile=@"c:\trylogfile.txt";
StreamWriter mylogwriter = new StreamWriter(logfile);
mylogwriter.WriteLine(t);
mylogwriter.WriteLine(childProcess.ExitCode);
mylogwriter.Close();
}
catch (Exception e)
{
string logfilename = @"C:\catchlogfile.txt";
StreamWriter logwriter = new StreamWriter(logfilename);
logwriter.WriteLine(e.Message);
logwriter.WriteLine(e.StackTrace);
Exception et = e.InnerException;
while (et != null)
{
logwriter.WriteLine(et.Message);
logwriter.WriteLine(et.StackTrace);
et = et.InnerException;
}
logwriter.Close();
}
}
这就是在python端运行的内容:
import sys, os;
if os.path.join(sys.path[0][:sys.path[0].rfind(os.sep)], '../..') not in sys.path:
sys.path.append(os.path.join(sys.path[0][:sys.path[0].rfind(os.sep)], '../..'))
import pythonequations
import string
import pyodbc
import string
import exceptions
import traceback
import os
tb = "No error"
try:
read data from database into mytext
equation = pythonequations.Equations2D.Exponential.Hocket_Sherby2D() #
equation.fittingTarget = 'SSQABS'
equation.ConvertTextToData(mytext, 1)
print "before init"
equation.Initialize() # now that the equation has data, set up the cache
print "before set initial parameters"
equation.SetGAParametersAndGuessInitialCoefficientsIfNeeded()
print "before fit"
equation.FitToCacheData()
print "before errors calculation"
equation.CalculateErrors()
except (Baseexception,Exception), e:
tb = traceback.format_exc() ,r
outfile = open("coveragelogfile","w")
outfile.write(tb)
outfile.close()
else:
put result in database
finally:
cnxn.close()
pythonequations是一个开源模块,它使用numpy和scipy,并在mingw g++上编译
我总是在reportserver日志中看到错误:
An error occurred during client rendering.
An error has occurred during report processing. (rsProcessingAborted)
An internal error occurred on the report server. See the error log for more details. (rsInternalError)
TRYLOGFILE.txt显示:
"
before init
before set initial parameters
1
"
python尝试,但没有捕获任何内容。
SSRS在具有管理员权限的用户下运行
恼人的是,每次失败后,我都可以自己运行批处理文件,并且它可以正常工作
对于登录到服务器的其他开发人员也是如此。
值得一提的是,在每个新用户的第一次运行中,mingw正是在python似乎崩溃的时候编译的。在第一次运行之后,但它从未显示此编译消息,mingw位于服务器上的c:\mingw中
感谢迄今幸存下来的勇士们水晶球破碎了。请稍后再试。或者向我们展示一些代码,展示到目前为止您的调试工作的结果(
print
statements before/before/before-critical steps in-program)等等……这个问题中有很多活动部分。如果你能提供足够的代码,让别人能够重新编程,这会有所帮助。例如,向我们展示C#“进程”中的内容,向我们展示足够的代码来演示python脚本失败的地方。向我们解释SSRS工作是如何启动的。当您完成此操作后,请标记为重新打开。添加代码和调试,我知道这里有很多事情正在进行,如果还需要什么,请告诉我