gpt4 book ai didi

c# - 在 IIS 7.5 中部署 WCF 服务

转载 作者:行者123 更新时间:2023-12-02 22:14:28 24 4
gpt4 key购买 nike

我是 WCF 的新手。我正在寻找在 IIS 上部署 WCF 并使用该服务的步骤。我按照在IIS上部署网站的步骤一样,同样设置默认文件为Service1.svc

现在,当我尝试使用此 wcf 服务时,出现以下错误。

Metadata contains a reference that cannot be resolved: 'http://manish-pc:8000/Service1.svc?wsdl'.
The WSDL document contains links that could not be resolved.
There was an error downloading 'http://manish-pc:8000/Service1.svc?xsd=xsd0'.
The underlying connection was closed: An unexpected error occurred on a receive.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
Metadata contains a reference that cannot be resolved: 'http://localhost:8000/Service1.svc'.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:8000/Service1.svc. The client and service bindings may be mismatched.
The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..
If the service is defined in the current solution, try building the solution and adding the service reference again.

以下是我在 Web.Config 文件中的服务详细信息

<system.serviceModel>
<services>
<service behaviorConfiguration="DemoWCF.Service1Behavior" name="DemoWCF.Service1">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/Service1.svc"/>
</baseAddresses>
</host>
<endpoint address="http://localhost:8000/Service1.svc"
binding="basicHttpBinding"
contract="DemoWCF.IService1"
bindingConfiguration="basicBinding">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>

<bindings>
<basicHttpBinding>
<binding name="basicBinding" textEncoding="utf-8"></binding>
</basicHttpBinding>
</bindings>

<behaviors>
<serviceBehaviors>
<behavior name="DemoWCF.Service1Behavior">
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

请指导我缺少的地方以及要采取的步骤。谢谢。

最佳答案

在谷歌搜索和观看视频后。最后我得到了解决方案。

此错误是由于 IIS 配置引起的,我并不在意。

  1. 打开您的 IIS 管理器控制台。
  2. 创建一个单独的应用程序池。
    A)。将 .NET Framework 版本设置为 4.0
    b).托管管道模式:经典
  3. 将应用程序池标识设置为“LocalSystem”。
  4. 按照与在 IIS 上部署 Web 应用程序相同的步骤(例如创建虚拟目录)进行操作。
  5. 创建您已创建的应用程序池的虚拟目录集。

并在客户端应用程序中使用 WCF 服务。

Click here to watch the video

如果您发现更多相关信息,请更新此问题/答案线程。
谢谢:)

关于c# - 在 IIS 7.5 中部署 WCF 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14724125/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com