English 中文(简体)
无法让 WCFExtras 与 WCF Service 一起工作
原标题:Unable to get WCFExtras to work with WCF Service
  • 时间:2012-05-21 21:14:18
  •  标签:
  • wcf
  • wsdl

我发现一个错误,我无法为服务提取元数据。当我看WCFExtras样本时,它看起来都很好,样本也很好。唯一的区别是,我的WCF服务是.NET 4.0。

这就是我的网络。

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>

    <customErrors mode="Off" />

  </system.web>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <validation validateIntegratedModeConfiguration="false" />
    <directoryBrowse enabled="true" />
  </system.webServer>

  <system.serviceModel>
    <services>
      <service behaviorConfiguration="CDITecServices.TECServiceHelperBehavior"
               name="CDITecServices.ITECServiceHelper">
        <endpoint address=""
          behaviorConfiguration="CDITecServices.TECServiceHelperEndpointBehavior"
          binding="basicHttpBinding" contract="CDITecServices.ITECServiceHelper"/>
      </service>
    </services>


    <behaviors>
      <endpointBehaviors>
        <behavior name="CDITecServices.TECServiceHelperEndpointBehavior">
          <wsdlExtensions singleFile="True"/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="CDITecServices.TECServiceHelperBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true"
                        httpHelpPageEnabled="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <extensions>
      <behaviorExtensions>
        <!-- Declare that we have an extension called WSDL Extras-->
        <add name="wsdlExtensions"
             type="WCFExtras.Wsdl.WsdlExtensionsConfig, WCFExtras, Version=1.0.0.0,
                   Culture=neutral, PublicKeyToken=null"/>
      </behaviorExtensions>
    </extensions>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
                               multipleSiteBindingsEnabled="true"/> 
  </system.serviceModel>


</configuration>


This is what my interface looks like:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using WCFExtras.Wsdl.Documentation;

namespace CDITecServices
{
    [XmlComments]
    [ServiceContract]
    public interface ITECServiceHelper
    {

        [OperationContract]
        void DownloadDataFile(string OrderTicketId, string Username,
                              string Password, string UserDatabase);

        [OperationContract]
        List<string> GetRecordsFromFile(string OrderTicketId, ref long StartIndex);

        // TODO: Add your service operations here
    }
}
问题回答

将您的服务名称从 CDITec Services.ITEC Services helper 更新为 CDITec Services.TEC Services helper 类名。

<service behaviorConfiguration="CDITecServices.TECServiceHelperBehavior" name="CDITecServices.TECServiceHelper">

& lt; service> 标签上的名称属性必须匹配您的服务类的名称, 完全合格, 包括命名空间 。





相关问题
Calling java SOAP web-Service from iPhone

I have a query regarding calling java SOAP web-Service from iPhone. I have successfully implemented calling .asmx type web services. But I am getting following error when I try to implement same for ...

WSDL from WCF Issue

I m trying to use NeoLoad to generate and execute SOAP requests and upon supplying the WSDL, it doesn t seem to like the imports that they are referring to. I m thinking I would need to flatten the ...

How do you support PHP exceptions in a wsdl file

I am not sure how to correctly make a fault element in a wsdl file repesenting a PHP exception. I have created a PHP web service that throws an exception for testing purposes. When I call this web ...

Error connecting to secure web service!

I am consistently receiving the following error when trying to create a Web Reference in Visual Studio 2008 to a 3rd party web service. Received an unexpected EOF or 0 bytes from the transport ...

What is the best solution for creating a SOAP Server in PHP?

I need some advice on which library is the best choice when it comes to creating SOAP servers (and eventually SOAP clients) in PHP. I know there is built-in functions for this, but is that really the ...

热门标签