我有一个当前在本地运行的简单WCF服务:
http://localhost:63951/WcfService.svc
这显示默认网站。当我将?wsdl附加到URL时出现问题:
http://localhost:63951/WcfService.svc?wsdl
与我的预期不同,此WDSL文档未显示任何操作/方法!
IWcfService:
using System.Collections.Generic;
using Ant.Domain.Model.DTO;
using System.ServiceModel;
using System.ServiceModel.Web;
namespace Ant.Application.Service
{
public interface IApplicationService
{
FileDTO GetFile(FileDTO fileDTO);
}
}
WcfService:
using System.ServiceModel;
using System.ServiceModel.Activation;
using Ant.Application.Service;
using Ant.Domain.Model.DTO;
using Ant.WcfService.Utils;
namespace Ant.WcfService
{
[ServiceContract(Namespace = "")]
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class WcfService : ServiceWExceptionManager
{
ApplicationService ApplicationSevice = new ApplicationService();
[OperationContract]
public FileDTO GetFile(FileDTO fileDTO)
{
return this.Process(() =>
{
return this.ApplicationSevice.GetFile(fileDTO);
});
}
}
}
的Web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="Ant.WcfService.WcfService">
<endpoint address="" behaviorConfiguration="Ant.WcfService.WcfServiceAspNetAjaxBehavior"
binding="webHttpBinding" contract="Ant.WcfService.WcfService" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="Ant.WcfService.WcfServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
什么可能导致WCF .svc服务不在WSDL文档中显示任何操作?
可能这是一个愚蠢的问题但是,使用谷歌,我找不到答案。 英语也不是我的母语;请原谅输入错误。