.net 4.0 在使用xp windows的iis 5.1上浏览我的WCF应用程序时出现问题

.net 4.0 在使用xp windows的iis 5.1上浏览我的WCF应用程序时出现问题,.net-4.0,windows-xp,wcf,metadata,iis-5,.net 4.0,Windows Xp,Wcf,Metadata,Iis 5,我添加了一个mapping.svc.NET4应用程序配置 已使用配置文件发布我的服务:服务URL-http://localhost:8732/Service1/" 站点/应用程序-“默认网站/服务1” 并选中了iis选项 <host> <baseAddresses> <add baseAddress = "http://localhost:8732/Service1/" /> </baseAddresses

我添加了一个mapping.svc.NET4应用程序配置 已使用配置文件发布我的服务:服务URL-http://localhost:8732/Service1/" 站点/应用程序-“默认网站/服务1” 并选中了iis选项

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
我的web.config文件:

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
源错误:

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
在执行当前web请求期间生成了未经处理的异常。有关异常的起源和位置的信息可以使用下面的异常堆栈跟踪来识别

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
堆栈跟踪:

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
[HostingEnvironmentException:无法访问IIS元数据库。] System.Web.Configuration.MetabaseServerConfig.MapPathCaching(字符串siteID,虚拟路径)+1076 System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath2.MapPath(字符串siteID,VirtualPath vpath)+9 System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath VirtualPath,布尔permitNull)+301 System.Web.Hosting.HostingEnvironment.MapPathInternal(VirtualPath VirtualPath,布尔permitNull)+51 System.Web.CachedPathData.GetPhysicalPath(VirtualPath-VirtualPath)+39 System.Web.CachedPathData.GetConfigPathData(字符串configPath)+704 System.Web.CachedPathData.GetConfigPathData(字符串configPath)+583 System.Web.CachedPathData.GetApplicationPathData()+38 System.Web.CachedPathData.getVirtualPath(VirtualPath VirtualPath,布尔permitPathsOutsideApp)+8782255 System.Web.Configuration.RuntimeConfig.GetConfig(虚拟路径)+46 System.Web.Configuration.RuntimeConfig.GetLKGRuntimeConfig(虚拟路径)+96

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />


版本信息:Microsoft.NET Framework版本:4.0.30319;ASP.NET版本:4.0.30319.1

是否检查了ASP.NET的IIS注册?通过确保ASPX页面正常工作来检查。如果未从适合您正在使用的框架版本(包括32位或64位版本)的正确文件夹中使用,则会被告知,如果在安装.NET framework后安装IIS,则会出现“无法访问IIS元数据库”错误,补救方法是重新安装ASP.NET

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
要解决此错误,我遵循以下步骤 1.停止IIS 2.在命令提示符下运行以下命令以重新安装aspnet

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet\u regiis.exe-i

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
结果: 开始安装ASP.NET(2.0.50727)。 .................................................................. 已完成安装ASP.NET(2.0.50727)。 3.重新启动的IIS和WCF服务正在响应,没有任何问题

    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Service1/" />
      </baseAddresses>
    </host>

    <endpoint address="" binding="wsHttpBinding" contract="WcfService.IService1">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>

</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />