asp.net FlashPrinter在Service服务转换问题。
谁有成功的案例啊,我用FlashPrinter 在web端可以正常,但是用后台Service服务就不行,文件不能转换成功,也不出错,感觉是那个FlashPrinter进程都没开启,因为他在执行cmd命令的时候需要弹出一个窗口,而在Service中是不能弹出窗口的.....所有 各位有无好的办法可以解决的啊。我要放在服务里面定时自动做转换. 下面是我用的转换方法
//文件转换为swf文件
private void CreateSWF(out string filepathswf, string loadname)
{
StreamWriter SW = null; ;
System.Diagnostics.Process p = new System.Diagnostics.Process();
filepathswf = "";
try
{
string flashpaper = GetConfig.Instance.DocumentToolUrl; //获取FlashPaper安装路径
string FPath = GetConfig.Instance.DocumentUrl;//获取存放路径
string filname = System.Guid.NewGuid().ToString();
SW = File.CreateText(GetConfig.Instance.DocumentUrl + "news/" + filname + ".swf");
SW.Close();
System.Text.StringBuilder command = new System.Text.StringBuilder();
command.Append("\"").Append(flashpaper).Append("\" ").Append(FPath + loadname).Append(" -o ").Append(FPath + "news/").Append((filname + ".swf"));
p.StartInfo.FileName = "cmd";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p.Start();
string strOutput = null;
p.StandardInput.WriteLine(command.ToString());
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
p.WaitForExit();
p.Close();
SW.Dispose();
filepathswf = "news/" + filname + "." + "swf";
}
catch (Exception ex)
{
filepathswf = "";
p.Dispose();
if (SW != null)
SW.Dispose();
ReportLog.WriteLog("正在转换文档失败,错误原因:" + ex.Message.ToString());
}
} --------------------编程问答-------------------- 切记权限一定要给足 --------------------编程问答--------------------
我现在是在本地进行测试,权限我所有的用户都已经给了完全控制,但是就是不行,我创建的那个文件创建了,但是就是开始转换的数据写入为零,都没执行 那个转换动作。
在web页面访问就可以正常访问。
补充:.NET技术 , ASP.NET