简体   繁体   中英

Hosting WPF application within IIS

I have created a WPF application (contains 8 projects). one project is of type (Class Library) ,this dll contains class which implement System.Web.IHttpHandler as the following.

public class ReportFileHttpHandler : IHttpHandler
{
    public bool IsReusable
    {
        get { return false; }
    }

    public void ProcessRequest(HttpContext context)
    {
        // some code
    }
 }

this HttpHandler is designed to interrupt the IIS request and handle the requrest of the xml file.

I also created a web.config file which exists inside this dll.

 <system.webServer>
<handlers>
  <add verb="*" path="*.xml" type="ReportFileHttpHandler"  name="ReportFileHttpHandler"/>
</handlers>

Every thing is good here. I want to do the following : I want to test the code inside the "ReportFileHttpHandler" ,so I need to host the my WPF application within (inside) the IIS to make test. in this way I can write URL inside the Browser (which end with .xml) to execute the code in the method

public void ProcessRequrest(HttpContext context)

How can I Host the WPF application inside the IIS ?

any idea will be helpful, thank you

  1. Create a webapplication in IIS say MyWPFApp.
  2. Set physical path of application to directory where ReportFileHttpHandler assembly resides say C:\\xxx\\ReportFileHttpHandler\\bin\\Debug.
  3. Make sure that ReportFileHttpHandler.dll and web.config are in same directory.
  4. Browse url http://localhost/mywpfapp/myfile.xml in browser.
  5. If you attach w3wp.exe process corresponding to app pool of your web application in Visual Studio, you should be able to debug your handler dll.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM