我创建并部署了一个非常简单的WCF服务。但是当从IE访问它时,我得到了这个:
HTTP Error 500.19 - Internal Server Error Description: The requested page cannot be accessed because the related configuration data for the page is invalid. Error Code: 0x80070005 Notification: BeginRequest Module: IIS Web Core Requested URL: http://localhost:80/ProductsService/ProductsService.svc Physical Path: C:\Users\Administrator\Documents\Visual Studio 2008\Projects\ProductsService\ProductsService\ProductsService.svc Logon User: Not yet determined Logon Method: Not yet determined Handler: Not yet determined Config Error: Cannot read configuration file Config File: \\?\C:\Users\Administrator\Documents\Visual Studio 2008\Projects \ProductsService\ProductsService\web.config Config Source: -1: 0:
More Information... This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.
这是我的web.config文件的内容:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<dataConfiguration defaultDatabase="AdventureWorksConnection" />
<connectionStrings>
<add name="AdventureWorksConnection" connectionString="Database=AdventureWorks; Server=(localhost)\SQLEXPRESS;Integrated Security=SSPI"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.serviceModel>
<services>
<service name="Products.ProductsService">
<endpoint address=""
binding="basicHttpBinding"
contract="Products.IProductsService" />
</service>
</services>
</system.serviceModel>
</configuration>
答案 0 :(得分:2)
好吧,看起来您的服务根本没有公开元数据交换 - 您至少需要添加serviceMetadata行为,以便客户端可以查询服务的元数据,以及是否希望能够使用浏览器,您还需要在该serviceMetadata行为上启用httpGet:。
像这样扩展你的web.config:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="Metadata">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Products.ProductsService" behaviorConfiguration="Metadata">
<endpoint address=""
binding="basicHttpBinding"
contract="Products.IProductsService" />
</service>
</services>
</system.serviceModel>
马克
答案 1 :(得分:2)
检查Web应用程序文件夹权限,并确保以下用户和组包含完整权限:\ IIS_IUSRS和\ IUSR。
答案 2 :(得分:0)
对于404.3错误你有没看过这个link?
希望这有帮助。