简体   繁体   English

在IIS 7中部署WCF Web服务-出现错误

[英]Deploy WCF Web Service in IIS 7 - Getting Error

I'm trying to add a service reference in VS 2010 to a WCF Web Service I have on a Server 2008/IIS7 server. 我试图将VS 2010中的服务引用添加到Server 2008 / IIS7服务器上的WCF Web服务中。 I put the service into an existing/working ASP.NET site. 我将该服务放入了一个现有的/正在运行的ASP.NET站点中。 When I type in the url of the service, it comes up with the standard service screen, but when I try to add the reference to a new website project I'm developing, I get the following error. 当我键入服务的URL时,它会出现在标准服务屏幕上,但是当我尝试将引用添加到我正在开发的新网站项目中时,会出现以下错误。

The document at the url https://www.nameofsite.net/service.svc?wsdl was not recognized as a known document type. 网址为https://www.nameofsite.net/service.svc?wsdl的文档未被识别为已知的文档类型。 The error message from each known type may help you fix the problem: - Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. 每种已知类型的错误消息都可以帮助您解决问题:-“ XML模式”的报告为“无法识别文档格式(内容类型为'text / html; charset = UTF-8')。”。 - Report from 'https://www.nameofsite.net/service.svc?wsdl' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. -来自“ https://www.nameofsite.net/service.svc?wsdl”的报告为“无法识别文档格式(内容类型为'text / html; charset = UTF-8')”。 - Report from 'DISCO Document' is 'Discovery document at the URL https://www.nameofsite.net/Service.svc?disco could not be found.'. -“ DISCO文档”中的报告是“找不到URL https://www.nameofsite.net/Service.svc?disco上的发现文档”。 - The document format is not recognized. -无法识别文件格式。 - Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. -来自“ WSDL文档”的报告为“无法识别文档格式(内容类型为'text / html; charset = UTF-8')”。 Metadata contains a reference that cannot be resolved: 'https://www.nameofsite.net/service.svc?wsdl'. 元数据包含无法解析的引用:“ https://www.nameofsite.net/service.svc?wsdl”。 There was no endpoint listening at https://www.nameofsite.net/service.svc?wsdl that could accept the message. https://www.nameofsite.net/service.svc?wsdl上没有侦听终结点的端点可以接受该消息。 This is often caused by an incorrect address or SOAP action. 这通常是由不正确的地址或SOAP操作引起的。 See InnerException, if present, for more details. 有关更多详细信息,请参见InnerException(如果存在)。 The remote server returned an error: (404) Not Found. 远程服务器返回错误:(404)找不到。 If the service is defined in the current solution, try building the solution and adding the service reference again. 如果服务是在当前解决方案中定义的,请尝试构建解决方案并再次添加服务引用。

I tried adding the mime type svc to IIS and that didn't work. 我尝试将MIME类型svc添加到IIS,但没有成功。 I see that there's a lot of talk about soap 1.1 not communicating with soap 1.2 but I'm too new to this to even follow the instructions I've seen. 我看到有很多关于肥皂1.1无法与肥皂1.2进行通信的讨论,但是我对此还太陌生,甚至无法遵循我所看到的说明。 Please help. 请帮忙。 Thanks. 谢谢。

Is the service publishing its metadata? 服务是否发布其元数据? Check the httpsGetEnabled flag in the web.config file for the service: 检查web.config文件中的httpsGetEnabled标志以获取该服务:

<behaviors>
 <serviceBehaviors>
  <behavior name="NewBehavior">
    <serviceMetadata httpsGetEnabled="true" 
     httpsGetUrl="https://myComputerName/myEndpoint" />
  </behavior>
 </serviceBehaviors>
</behaviors>

For more info on these tags: ServiceMetaData 有关这些标签的更多信息: ServiceMetaData

You may also need this endpoint configured in your web.config for the service: 您可能还需要在web.config中为服务配置以下端点:

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

Some more background: Web.Config 更多背景信息: Web.Config

WSDL vs MEX WSDL和MEX

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM