wix unexpected child element 'Website'

强颜欢笑 提交于 2019-12-11 04:19:09

问题


With the code below, everything compiles without any error. But when I run the resulting MSI, I don't see any site created in IIS:

<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:iis='http://schemas.microsoft.com/wix/IIsExtension'>
  <iis:WebSite Id='dp_service_site' Description='Default Web Site'>
    <iis:WebAddress Id="AllUnassigned" Port="80" />
  </iis:WebSite>
  .
  .
  <DirectoryRef Id='DPDIR'>
    <Component Id='dservice' DiskId='1' Guid ='21e0c49d-e9a6-4de6-894c-d0632ea45f5a'>
      <iis:WebVirtualDir Id='dp_wvd' Alias="DocumentPublisher" Directory='DPDIR'   WebSite='dp_service_site'>           
        <iis:WebApplication Id='dp_app' Name='Default Application' WebAppPool='dp_pool' Isolation='medium'>
        </iis:WebApplication>
      </iis:WebVirtualDir>          
      <iis:WebAppPool Id='dp_pool' Identity='networkService' Name='dservice' />
    </Component>
  </DirectoryRef>
  .
  .
  <Feature Id='Service' Title='Document Service' Level='1'>
    <ComponentRef Id='dservice' />
  </Feature>
</Wix>

I am getting error. I have changed the code as per you have mentioned above. I have attached the screenshot along with this


回答1:


I believe the issue here is that you are not creating the WebSite within a component, so instead the installer is just trying to do a lookup for an existing website. Instead you should probably have something like this:

<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:iis='http://schemas.microsoft.com/wix/IIsExtension'>

  .
  .
  <DirectoryRef Id='DPDIR'>
    <Component Id='dservice' DiskId='1' Guid ='21e0c49d-e9a6-4de6-894c-d0632ea45f5a'>
      <iis:WebVirtualDir Id='dp_wvd' Alias="DocumentPublisher" Directory='DPDIR'   WebSite='dp_service_site'>           
        <iis:WebApplication Id='dp_app' Name='Default Application' WebAppPool='dp_pool' Isolation='medium'>
        </iis:WebApplication>
      </iis:WebVirtualDir>          
      <iis:WebAppPool Id='dp_pool' Identity='networkService' Name='dservice' />
    </Component>
    <Component Id='website'>
      <iis:WebSite Id='dp_service_site' Description='Default Web Site' Directory='DPDIR'>
        <iis:WebAddress Id="AllUnassigned" Port="80" />
      </iis:WebSite>
    </Component>
  </DirectoryRef>
  .
  .
  <Feature Id='Service' Title='Document Service' Level='1'>
    <ComponentRef Id='dservice' />
    <ComponentRef Id'website' />
  </Feature>
</Wix>

So then the website will be created as a separate component. I believe that since you have specified a port number, if a website already exists on that port then it will modify that existing website instead of creating a new one.

UPDATE: As the error indicated, you need to add a Directory attribute to the WebSite element pointing to 'DPDIR'. I have updated my example above.



来源:https://stackoverflow.com/questions/13561544/wix-unexpected-child-element-website

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!