使用IIS上托管的WCF服务 [英] Consume WCF service hosted on IIS

查看:64
本文介绍了使用IIS上托管的WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是WCF的新手。我期待步骤在IIS上部署WCF并使用该服务。我按照与在IIS上部署网站相同的步骤,也将默认文档设置为Service1.svc



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



I am newbie to WCF. I am looking to steps to deploy WCF on IIS and consume the service. I have follow the steps same as to deploy the Website on IIS, also set the default document to Service1.svc

Now when I am trying to consume this wcf service it is giving me the following error.

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详细信息




Following is my Service web.config details

<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>





请指导我。

谢谢。



Please guide me.
Thanks.

推荐答案

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



由于我没有打扰的IIS配置,会发生此错误。



打开您的IIS管理器控制台。

1.单独创建一个应用程序池。

a)。将.NET Framework版本设置为4.0

b)。托管管道模式:经典

2.将Applicaiton池标识设置为LocalSystem。

3.按照与在IIS上部署Web应用程序相同的步骤,如创建虚拟机

目录。

4.创建您创建的应用程序池的虚拟目录集。

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



点击此处观看视频



如果您对此有更多了解,请更新这个问题/答案主题。

谢谢:)
After search on google and watching videos. Finally I got the solution.

This error occur due to IIS configuration that I was not bother about.

open your IIS Manager console.
1. Make a separate applicaiton pool.
a). Set .NET Framework version to 4.0
b). Managed pipeline mode : Classic
2. Set Applicaiton Pool Identity to "LocalSystem".
3. Follow the steps same as to deploy a web application on IIS like creating a Virtual
Directory.
4. Create the Virtual Directory set that Application Pool you have created.
5. And consume the WCF Service in Client application.

Click here to watch the video

Kindly Update this question / answer thread, if you find more about this.
Thanks :)


这篇关于使用IIS上托管的WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆