Я использую приведенный ниже код для запуска IIS в Windows Form.
if (hWndDocked != IntPtr.Zero) //don't do anything if there's already a window docked.
return;
hWndParent = IntPtr.Zero;
pDocked = Process.Start(@"C:\Windows\System32\inetsrv\inetmgr");
while (hWndDocked == IntPtr.Zero)
{
pDocked.WaitForInputIdle(1000); //wait for the window to be ready for input;
pDocked.Refresh(); //update process info
if (pDocked.HasExited)
{
return; //abort if the process finished before we got a handle.
}
hWndDocked = pDocked.MainWindowHandle; //cache the window handle
}
//Windows API call to change the parent of the target window.
//It returns the hWnd of the window's parent prior to this call.
hWndOriginalParent = SetParent(hWndDocked, panel1.Handle);
//Wire up the event to keep the window sized to match the control
panel1.SizeChanged += new EventHandler(Panel1_Resize);
//Perform an initial call to set the size.
Panel1_Resize(new Object(), new EventArgs());
Но я получаю сообщение об ошибке:
система не может найти файл
Но то же самое и с блокнотом.
0
user1104946
24 Июн 2016 в 17:01
1 ответ
Лучший ответ
У меня была такая же проблема, и я нашел только один способ:
Process.Start(Environment.SystemDirectory + "\\inetsrv\\iis.msc");
Я надеюсь, что это помогает!
2
Brugner
2 Фев 2017 в 17:29
Похожие вопросы
Новые вопросы
c#
C # (произносится как «резкий») - это высокоуровневый, статически типизированный язык программирования с несколькими парадигмами, разработанный Microsoft. Код C # обычно нацелен на семейство инструментов и сред выполнения Microsoft .NET, включая, среди прочего, .NET Framework, .NET Core и Xamarin. Используйте этот тег для вопросов о коде, написанном на C # или в формальной спецификации C #.
"C:\Windows\System32\inetsrv\inetmgr"
на самом деле?