0
을 사용하면 Windows 서비스로 호스팅되는 wcf 서비스를 사용하고 싶습니다. 나는 이것을 어떻게 얻는 지 모른다?Windows 서비스에서 WCF 서비스를 배포하고 웹 응용 프로그램에서 웹 응용 프로그램
이 작업을 수행하려면 몇 가지 링크 또는 예제를 제공해 주실 수 있습니까? 감사합니다. .
을 사용하면 Windows 서비스로 호스팅되는 wcf 서비스를 사용하고 싶습니다. 나는 이것을 어떻게 얻는 지 모른다?Windows 서비스에서 WCF 서비스를 배포하고 웹 응용 프로그램에서 웹 응용 프로그램
이 작업을 수행하려면 몇 가지 링크 또는 예제를 제공해 주실 수 있습니까? 감사합니다. .
이것은 좋은 접근 방법이 아닙니다. 웹 응용 프로그램은 브라우저 내에서 샌드 박싱되어야하며 어떤 방식 으로든 시스템 리소스에 액세스해서는 안됩니다. Windows 서비스에서 호출하는 래퍼 WCF 웹 서비스를 만들고 웹 응용 프로그램이 웹 서비스에 액세스 할 수 있습니다. 이 문제에 대답을 위해서
:
Original Link for Code :
private void Page_Load(object sender, System.EventArgs e)
{
string PcName = "PC Name";
WindowsImpersonationContext wic = null;
try
{
IPrincipal p = this.User;
WindowsIdentity id = (WindowsIdentity)p.Identity;
Response.Write("Running as:" + WindowsIdentity.GetCurrent().Name + "<br>");
wic = id.Impersonate();
Response.Write("Running as:" + WindowsIdentity.GetCurrent().Name + "<br>");
ServiceController[] services = ServiceController.GetServices();
for(int i = 0; i < services.Length; i++)
{
if (services[i].DisplayName == "COM+ System Application")
{
Response.Write(services[i].DisplayName + " - ");
Response.Write(services[i].Status.ToString());
Response.Write("<br>");
ServiceController sc = new ServiceController(services[i].DisplayName,PcName);
if (sc.Status == ServiceControllerStatus.Running)
{
sc.Stop();
}
if (sc.Status == ServiceControllerStatus.Stopped)
{
sc.Start();
}
}
}
}
catch(Exception err)
{
Response.Write(err.Message);
}
finally
{
wic.Undo();
}
}
하지만 보안 문제로 실행, 그래서 스레드에서 모든 응답에서 좀 걸릴 수 있습니다.