none
xbap应用程序,iis发布如何读取资源?请各位高手帮忙看看。 RRS feed

  • 问题

  • 程序中根据相对路径读取某些配置文件,在vs中没问题,但是发布到iis上,路径找不到资源。

    打包时这些资源也没在打包的文件中。

    从没处理过xbap的发布,我的问题是:

    我认为有两种可能的解决办法。A寻找在服务器上读取不包含的文件这个思路(用"pack://siteOfOrigin:,,,/路径"没用);B将这些资源包含到程序中一起ClickOne出来? 应该用哪个,是否都可行?

    2014年11月6日 9:30

答案

全部回复

  • 你好,

    你有没有事先先看一下MSDN文档关于XBAP的deploy http://msdn.microsoft.com/en-us/library/aa970060(v=vs.110).aspx

    步骤已经详细描述在这上面了,你先按照以下步骤检查一下,关于ClickOnce实际上正常的deploy步骤做的就是ClickOnce机制里的Download,没多大区别:

    When you build an XBAP, the output includes the following three files:

    File

    Description

    Executable (.exe)

    This contains the compiled code and has an .exe extension.

    Application manifest (.manifest)

    This contains metadata associated with the application and has a .manifest extension.

    Deployment manifest (.xbap)

    This file contains the information that ClickOnce uses to deploy the application and has the .xbap extension.

    You deploy XBAPs to a Web server, for example Microsoft Internet Information Services (IIS) 5.0 or later versions. You do not have to install the .NET Framework on the Web server, but you do have to register the WPF Multipurpose Internet Mail Extensions (MIME) types and file name extensions. For more information, see How to: Configure IIS 5.0 and IIS 6.0 to Deploy WPF Applications.

    To prepare your XBAP for deployment, copy the .exe and the associated manifests to the Web server. Create an HTML page that contains a hyperlink to open the deployment manifest, which is the file that has the .xbap extension. When the user clicks the link to the .xbap file, ClickOnce automatically handles the mechanics of downloading and starting the application. The following example code shows an HTML page that contains a hyperlink that points to an XBAP.

    <html> 
      <head></head>
      <body> 
        <a href="XbapEx.xbap">Click this link to launch the application</a>
      </body> 
    </html> 
    

    You can also host an XBAP in the frame of a Web page. Create a Web page with one or more frames. Set the source property of a frame to the deployment manifest file. If you want to use the built-in mechanism to communicate between the hosting Web page and the XBAP, you must host the application in a frame. The following example code shows an HTML page with two frames, the source for the second frame is set to an XBAP.

    <html> 
      <head>A page with frames.</head>
        <frameset cols="50%,50%"> 
          <frame src="introduction.htm" > 
          <frame src="XbapEx.xbap" > 
      </frameset> 
    </html>
    
    

    Regards,



    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2014年11月7日 9:35
    版主
  • 自己解决了,所有要读取的数据作为‘内容’包括在项目中,然后以相对路径读取就行了。
    2014年11月14日 0:33