谁有成功的案例啊,我用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());
}
}
我要放在服务里面定时自动做转换. 下面是我用的转换方法
//文件转换为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());
}
}
解决方案 »
- 为什么我的css放在文件夹里面就取不到!
- 类似页面qq那种功能?
- asp.net树形
- 请教分页采集!这样的分页__doPostBack('LinkButton4',''),多谢了
- 错在那儿?Button1.Attributes.Add("onclick","window.external.AddFavorite('www.sina.com.cn','我的站点')")
- 忧郁呀,止步不前?
- 无图片 如何重定位到新的图片(图片在数据库中)
- asp.net使用aspnetpage等分页控件情况下如何根据屏幕分辩率动态调整pagesize
- 为什么取不到数据?如果你有时间帮我解决一下
- 不安装STDIO。NET,想用EDITPLUS2。11开发asp。net的网页,要装那些必须的DD?(急,在线等)
- 谁用过ZPFlashUploadAPI上传大文件。。求助。。
- 为什么现在做论坛大家都是使用phpwind和discuz模板,而不是选择自己开发呢?
我现在是在本地进行测试,权限我所有的用户都已经给了完全控制,但是就是不行,我创建的那个文件创建了,但是就是开始转换的数据写入为零,都没执行 那个转换动作。在web页面访问就可以正常访问。