小编Oli*_*ker的帖子

更改流程优先级不起作用

我运行了一个Audio Repeater应用程序,它允许我同时通过我的耳机和扬声器播放声音.应用程序本身具有将自身设置为"RealTime"的能力,但它只将其设置为高,所以此刻我必须自己在任务管理器中设置它.

我决定自动执行此操作,因此我在C#中编写了一个小脚本,它将改变我的进程优先级(我会在完成后添加启动)

namespace ProcessRealtime
{
    class Program
    {
        static void Main(string[] args)
        {
            Process[] processes = Process.GetProcessesByName("audiorepeater");
            foreach (Process proc in processes)
            {
                Console.WriteLine("Changing Priority for: "+proc.Id+" To RealTime");
                proc.PriorityClass = ProcessPriorityClass.RealTime;
                if (proc.PriorityClass == ProcessPriorityClass.RealTime)
                {
                    Console.WriteLine("Worked");
                }
            }
            Console.ReadLine();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

问题是它不适用更改. 桌面截图

有谁知道为什么这不起作用?

c# windows

14
推荐指数
2
解决办法
1万
查看次数

从自定义httpHandlers评估ASPX页面

我到处寻找帮助,开始惹恼我.

我正在创建一个内部工具网站,用于存储工具及其相关信息.

我的愿景是拥有一个网址(Http://website.local/Tool/ID)其中ID是我们想要显示的工具的ID.我的理由是,我可以扩展URL的功能以允许各种其他功能.

目前我使用自定义的httpHandler拦截"工具"文件夹中的任何URL.

    using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Tooling_Website.Tool
{
    public class ToolHandler : IHttpHandler
    {
        public bool IsReusable
        {
            get { return false; }
        }


        public void ProcessRequest(HttpContext context)
        {
            //The URL that would hit this handler is: http://{website}/Tool/{AN ID eg: http://{website}/Tool/PDINJ000500}
            //The idea is that what would be the page name is now the ID of the tool.
            //tool is an ASPX Page.
            tool tl = new tool();
            System.Web.UI.HtmlTextWriter htr = new System.Web.UI.HtmlTextWriter(context.Response.Output); …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net httphandler

6
推荐指数
1
解决办法
2082
查看次数

标签 统计

c# ×2

.net ×1

asp.net ×1

httphandler ×1

windows ×1