Xml 无法从wcf获取元数据,404错误

Xml 无法从wcf获取元数据,404错误,xml,vb.net,wcf,http,metadata,Xml,Vb.net,Wcf,Http,Metadata,我正在做第25章《使用wcf网络中心项目》一书中的最后一个教程。我目前收到一个错误,说它无法获取我的元数据,我在运行我的服务时收到一个404错误。请帮忙。我正在使用http://localhost我的文件就在这里 C:\inetpub\wwwroot\vbautologtwcfservice Service.svc <%@ ServiceHost Language="VB" Debug="true" Service="VbAutoLotWCFService" CodeBehind="~

我正在做第25章《使用wcf网络中心项目》一书中的最后一个教程。我目前收到一个错误,说它无法获取我的元数据,我在运行我的服务时收到一个404错误。请帮忙。我正在使用
http://localhost
我的文件就在这里
C:\inetpub\wwwroot\vbautologtwcfservice

Service.svc

<%@ ServiceHost Language="VB" Debug="true" 
Service="VbAutoLotWCFService" 
CodeBehind="~/App_Code/VbAutoLotWCFService.vb" %>`
`
Web.config

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration>
  <appSettings/>
  <connectionStrings/>
  <!--
    For a description of web.config changes for .NET 4.5 see http://go.microsoft.com/fwlink/?LinkId=235367.

    The following attributes can be set on the <httpRuntime> tag.
      <system.Web>
        <httpRuntime targetFramework="4.5" />
      </system.Web>
  -->
  <system.web>
    <!--
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions 
            where data loss can occur. 
            Set explicit="true" to force declaration of all variables.
        -->
    <compilation debug="false" strict="false" explicit="true" targetFramework="4.5"/>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
      <namespaces>
        <clear/>
        <add namespace="System"/>
        <add namespace="System.Collections"/>
        <add namespace="System.Collections.Specialized"/>
        <add namespace="System.Configuration"/>
        <add namespace="System.Runtime.Serialization"/>
        <add namespace="System.ServiceModel"/>
        <add namespace="System.Text"/>
        <add namespace="System.Text.RegularExpressions"/>
        <add namespace="System.Linq"/>
        <add namespace="System.Web"/>
        <add namespace="System.Web.Caching"/>
        <add namespace="System.Web.SessionState"/>
        <add namespace="System.Web.Security"/>
        <add namespace="System.Web.Profile"/>
        <add namespace="System.Web.UI"/>
        <add namespace="System.Web.UI.WebControls"/>
        <add namespace="System.Web.UI.WebControls.WebParts"/>
        <add namespace="System.Web.UI.HtmlControls"/>
      </namespaces>
    </pages>
    <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
    <authentication mode="Windows"/>
    <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
  </system.web>
  <system.web.extensions>
    <scripting>
      <webServices>
        <!--
              Uncomment this section to enable the authentication service. Include 
              requireSSL="true" if appropriate. 

          <authenticationService enabled="true" requireSSL = "true|false"/>
          -->
        <!--
              Uncomment these lines to enable the profile service, and to choose the 
              profile properties that can be retrieved and modified in ASP.NET AJAX 
              applications.

           <profileService enabled="true"
                           readAccessProperties="propertyname1,propertyname2"
                           writeAccessProperties="propertyname1,propertyname2" />
          -->
        <!--
              Uncomment this section to enable the role service.

          <roleService enabled="true"/>
          -->
      </webServices>
      <!--
        <scriptResourceHandler enableCompression="true" enableCaching="true" />
        -->
    </scripting>
  </system.web.extensions>
  <!--
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
  <system.serviceModel>
    <services>
      <service name="VbAutoLotWCFService" behaviorConfiguration="ServiceBehavior">
        <endpoint address="" binding="basicHttpBinding" contract="IAutoLotService"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>


404表示找不到资源。您是否在IS中设置了指向
C:\inetpub\wwwroot\vbautotwcfservice
的应用程序?创建项目时,我在visual basic下选择了文件->新建网站->WCF服务。对于Web位置,我选择了HTTP。这会将文件放在c:\inetpup\wwwroot目录中。也许IIS没有注意到这一点。我不知道。我启动了iis,现在我至少有了访问权限,但出现了错误。500.19错误:无法从错误摘要HTTP Error 500.19-内部服务器错误获取元数据无法访问请求的页面,因为该页面的相关配置数据无效。步骤1:启用IIS步骤2:使用此命令更新IIS。c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet\u regiis.exe-iru这解决了我的问题。谢谢。我现在可以访问dal中访问数据库的所有方法,但是现在我遇到了这个错误。未能调用该服务。可能原因:服务离线或无法访问;客户端配置与代理不匹配;现有代理无效。有关更多详细信息,请参阅堆栈跟踪。您可以尝试通过启动新代理、恢复到默认配置或刷新服务来进行恢复。