Tag: asp.net

为什么ffmpeg在进程中间随机停止?

ffmpeg感觉好像花了很长时间。 然后我看看我的输出文件,我看到它在6到8mbs之间停止。 完全编码的文件大约是14mb。 为什么ffmpeg会停止? 我的代码锁定了StandardOutput.ReadToEnd();. 我不得不杀死这个过程(看到它不会移动超过10秒,当我看到它每秒更新一次)然后我得到stdout和错误的结果。 stdout是“”stderr在下面。 输出消息显示文件大小已结束。 我也看到停止时CPU使用率下降。 我从视觉工作室复制了这个论点。 CD到同一工作目录并运行cmd(bin / ffmpeg)并粘贴参数。 它能够完成。 注意:我必须先退出并错误检查是否有故障。 int soundProcess(string infn, string outfn) { string aa, aa2; aa = aa2 = “DEAD”; var app = new Process(); app.StartInfo.UseShellExecute = false; app.StartInfo.RedirectStandardOutput = true; app.StartInfo.RedirectStandardError = true; //*/ app.StartInfo.FileName = @”bin\ffmpeg.exe”; app.StartInfo.Arguments = string.Format(@”-i “”{0}”” -ab 192k -y {2} […]

如何在数据集中搜索特定数据

我只是想问一下如何搜索数据集中的特定数据,因为我想搜索特定关键字的摘要并将其绑定到转发器我有表达式并且它不起作用 string keyword = “where summary like %”+ txtbKeyword.Text +”%” ; DataSet ds = new DataSet(); int selectedTopicID = Convert.ToInt32(ddlTopics.SelectedValue); int selectedSkillID = Convert.ToInt32(ddlSkills.SelectedValue); int selectedTypeID = Convert.ToInt32(ddlTypes.SelectedValue); ds = Resoursce.Search_Resource(selectedTopicID, selectedSkillID, selectedTypeID); lbl_totalResult.Text = ds.Tables[0].Rows.Count.ToString(); rp_resList.DataSource = ds.Tables[0].Select(keyword); rp_resList.DataBind(); 用户代码未处理System.Data.SyntaxErrorException HResult=-2146232032 Message=Syntax error: Missing operand after ‘summary’ operator. Source=System.Data StackTrace: at System.Data.ExpressionParser.Parse() at System.Data.DataExpression..ctor(DataTable […]

Web Service API提供下载/保存的多个csv文件

我有一个Web服务,我可以调用并保存返回的csv文件。 一切似乎都运转正常。 我现在感兴趣的是返回多个CSV文件供用户下载。 处理这个问题的正确方法是什么? 我猜我需要一种方法来打包它们(拉链?也许)? [HttpPost] [Route(“OutputTemplate”)] public HttpResponseMessage OutputTemplate() { HttpResponseMessage msg = new HttpResponseMessage(); string body = this.Request.Content.ReadAsStringAsync().Result; try { string contents = DoStuff(body) // get contents based on body MemoryStream stream = new MemoryStream(); StreamWriter writer = new StreamWriter(stream); writer.Write(contents); writer.Flush(); stream.Position = 0; msg.StatusCode = HttpStatusCode.OK; msg.Content = new StreamContent(stream); msg.Content.Headers.ContentType […]

HttpClient调用Windows-Authenication ApiController方法…但没有WindowsIdentity出现

当api-controller使用windows-authentication时,我的api控制器是否有办法获得启动api控制器调用的帐户的IIdentity? 我的“castController.User.Identity”是(类型)WindowsIdentity。 但它是“空的”。 空,原样:IsAuthenticated = false,以及一个空的UserName。 它不是空的,它是“空的”。 我的“WebTier”是一个运行自定义AppPool的IIS应用程序,运行自定义AppPool的IIdentity类似于“mydomain \ myServiceAccount”。 我正在尝试将“castController.User.Identity.Name”值作为此服务帐户。 (我想这可能是任何能够使用有效的Windows帐户连接到我的WebApiTier的客户端,但我提到这个以防万一它可能会抛出一个奇怪的猴子扳手) 我的“WebTier”(Mvc Application)有这样的方法: 你会注意到我使用UseDefaultCredentials的两种方法。 (阿卡,我一直试图解决这个问题) private async Task ExecuteProxy(string url) { HttpClientHandler handler = new HttpClientHandler() { UseDefaultCredentials = true }; handler.PreAuthenticate = true; WebRequestHandler webRequestHandler = new WebRequestHandler(); webRequestHandler.UseDefaultCredentials = true; webRequestHandler.AllowPipelining = true; webRequestHandler.AuthenticationLevel = System.Net.Security.AuthenticationLevel.MutualAuthRequired; webRequestHandler.ImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Identification; using (var client […]

捕获.aspx和.ascx页面中的exception

问题说明了一切,拿这个例子代码: 现在,如果在这些控件(位于母版页中)的某个位置抛出错误,它们将取消整个站点,如何捕获这些exception?

ASP.NET Web API序列化JSON错误:“自我引用循环”

与这一次长期斗争。 我正在使用ASP.NET Web API来提供与数据库的简洁HTTP / JSON交互。 我有一个实体名称Reservation with,如下所示: // Reservation public class Reservation { public int ID { get; set; } // ID (Primary key) public int EquipmentID { get; set; } // EquipmentID public string Username { get; set; } // Username public DateTime BeginDateTime { get; set; } // BeginDateTime public int? Duration […]

在我的Tiff文件上应用CCITT压缩后,它会生成一个带有纯黑色背景的图像

使用LZW压缩创建tiff文件(默认): – System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(800, 1000); Graphics g = Graphics.FromImage(bitmap); g.DrawString(“Name: ” + Name.Text, outputFont, Brushes.Black, new PointF(0, 20)); g.DrawString(“Date Of Birth: ” + Date_Of_Birth.Text, outputFont, Brushes.Black, new PointF(0, 40)); g.DrawString(“Address: ” + Address.Text, outputFont, Brushes.Black, new PointF(0, 60)); g.DrawString(“City: ” + City.Text, outputFont, Brushes.Black, new PointF(0, 80)); g.DrawString(“State: ” + State.Text, outputFont, […]

将集合数据从HTML / Razor表单发送/ POST到MVC操作参数模型

我正在开展一个项目,帮助学生和顾问使用ASP.NET MVC 5为下一学期选择最好的课程。第一步是让学生从列表中选择他已经学过的课程。 显示列表的控制器是: public ActionResult AddCourseVM (int? id) { Student student = db.Students.Find(id); // List potentialCourses = student.StudentConcentration.RequiredCourses.ToList(); List potentialCourses = db.BaseCourses.ToList(); AddCourseViewModel vModel = new AddCourseViewModel(student, potentialCourses); List listCourses = new List(); foreach(BaseCourse baseC in potentialCourses) { Course c = new Course(); c.BaseCourse = baseC; c.Student = student; listCourses.Add(c); } vModel.PossibleCourses = listCourses; […]

使用byte 读取大文件会出错

可能重复: 在C#中散列SHA1大文件(超过2GB) 我有一个大的文件大小的文件,它给我错误“抛出类型’System.OutOfMemoryException’的exception。” 任何人都有解决此问题的想法或解决方案。 请帮忙。 示例代码…. private string GetSha1() { string filePath = txtFileName.Text; byte[] filebytes = System.IO.File.ReadAllBytes(filePath); byte[] hashValue; SHA1Managed hashString = new SHA1Managed(); string hex = “”; hashValue = hashString.ComputeHash(filebytes); foreach (byte x in hashValue) { hex += String.Format(“{0:x2}”, x); } return hex; } 在上面的代码中,我在下面的行中得到例外…. byte[] filebytes = System.IO.File.ReadAllBytes(filePath); filePath的文件大小> 500MB。

如何在ASP.NET MVC页面中声明全局变量

我最近开始使用asp.net mvc,但我遇到了一个问题。 我有一个aspx页面,它呈现了一些ascx页面。 我想要做的是在aspx页面声明一个全局变量,以便它对所有孩子都可见。 我试过 但它在子页面上不可见。 我能做什么?