2009-10-24 138 views
0

我创建并部署了一个非常简单的WCF服务。但是从IE浏览器访问时,我得到这个:HTTP错误500.19内部服务器错误

 
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

我相信你的IIS并不知道.svc文件 - 请参阅此博客文章,了解更多信息和解释如何解决该问题:rogerpence.com/blog/?p=280 – 2009-10-24 20:14:31

+0

看看我的答案http://stackoverflow.com/questions/5091640/http-error-500-19-internal-server-error/29032247#29032247。希望这有助于... – 2015-03-13 13:22:23

回答

2

嗯,它看起来像你的服务不公开任何元数据交换根本不需要 - 至少需要添加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> 

马克

+0

我认为这是安全相关的,因为我给我的服务文件夹的用户访问IIS_USRS,现在,我得到另一个错误: HTTP错误404.3 - 找不到 说明:您请求无法在这个网页由于在Web服务器上配置了多用途Internet邮件扩展(MIME)映射策略而被提供服务。您请求的页面具有不被识别的文件扩展名,并且不被允许。 – Attilah 2009-10-24 15:14:18

+2

我相信你的IIS并不知道有关.svc文件 - 请参阅此博客文章以获取更多信息和解释如何解决该问题:http://rogerpence.com/blog/?p=280 – 2009-10-24 16:25:01

0

为404.3错误你有没有采取看看这个link

希望这会有所帮助。

+0

没有提到403错误 – msulis 2010-03-08 04:53:43

+0

抱歉,我的意思是404.3 ..一定是一个错字错误..我会编辑我的文章。谢谢。 – daxsorbito 2010-03-09 05:43:51

1

检查Web应用程序文件夹权限并确保包含以下用户和组的完整权限:\ IIS_IUSRS和\ IUSR。

相关问题