我正在努力解决以下问题(这是大局):
我的Web项目中有一个支持WCF Silverlight的服务(基于DomainService类)。该服务旨在由Silverlight 5客户端以及非Silverlight消费者调用。
该服务在地址处显示WSDL信息 “http://localhost/mywebapproot/Services/MailService.svc”,因此它可以 由Web中的任何客户端发现和实现 项目(很好)。
以下是症状:
我将includeExceptionDetailInFaults置于True并尝试使用Fiddler / HTTPDebuggerPro检查服务,但他们没有向我提供有关该异常的任何详细信息。在我看来,Silverlight客户端在此配置中由于某种原因无法动态创建.SVC文件。
以下是实施:
MailService.svc 实施 <%@ ServiceHost Language =“C#”Debug =“true”Service =“MyCompany.Web.Services.MailService”CodeBehind =“MailService.svc.cs”%>
MailService.svc.cs 实施
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public sealed partial class MailService : DomainService, IMailService
{
}
IMailService接口
[ServiceContract(ConfigurationName = "MyCompany.Web.Services.IMailService")]
public interface IMailService
{
//Some public methods flagged as [OperationContract] go here
}
Web.Config 实施
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="Secure_Behavior_Configuration">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="Public_MailService_BasicHttpBinding" transferMode="Streamed"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
maxBufferPoolSize="2147483647">
<readerQuotas maxArrayLength="21400000" maxStringContentLength="21400000" maxBytesPerRead="21400000"/>
<security mode="None"/>
</binding>
</basicHttpBinding>
<services>
<service name="MyCompany.Web.Services.MailService" behaviorConfiguration="Secure_Behavior_Configuration">
<endpoint
address=""
binding="basicHttpBinding"
bindingConfiguration="Public_MailService_BasicHttpBinding"
contract="MyCompany.Web.Services.IMailService" />
<endpoint
address=""
binding="basicHttpBinding"
bindingConfiguration="Secure_MailService_BasicHttpBinding"
contract="MyCompany.Web.Services.IMailService" />
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
非常感谢您的帮助! 克里斯。