无法使WCFExtras与WCF服务一起工作
我收到一个错误,无法提取服务的元数据。当我查看WCFExtras示例时,它看起来都很好,并且该示例运行良好。唯一的区别是我的WCF服务是.NET4.0 这就是my web.config的外观:无法使WCFExtras与WCF服务一起工作,wcf,wsdl,Wcf,Wsdl,我收到一个错误,无法提取服务的元数据。当我查看WCFExtras示例时,它看起来都很好,并且该示例运行良好。唯一的区别是我的WCF服务是.NET4.0 这就是my web.config的外观: <?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0"/> <customErrors
<?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>
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
}
}
这就是我的界面的样子:
<?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>
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
}
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用System.Runtime.Serialization;
使用System.ServiceModel;
使用系统文本;
使用WCFExtras.Wsdl.Documentation;
命名空间CDITecServices
{
[XmlComments]
[服务合同]
公共接口ITECServiceHelper
{
[经营合同]
void DownloadDataFile(字符串OrderTicketId、字符串用户名、,
字符串密码,字符串用户数据库);
[经营合同]
列出GetRecordsFromFile(字符串OrderTicketId,ref long StartIndex);
//TODO:在此处添加服务操作
}
}
将您的服务名称从CDITecServices.ITECServiceHelper
更新为类名称CDITecServices.tecservice helper
<service behaviorConfiguration="CDITecServices.TECServiceHelperBehavior" name="CDITecServices.TECServiceHelper">
标记上的name属性必须与服务类的名称匹配,包括名称空间。“无法下拉元数据”-如何“拉动”它?确切的错误是什么?尝试在Visual Studio中运行svc或尝试从Visual Studio创建对服务的引用。如果部署svc,然后尝试浏览它,则会收到消息“此服务的元数据发布当前已禁用”