我使用以下命令:
svcutil.exe / language:c#/out:agnServiceClient.cs /config:app.config net.pipe://本地主机/ agnService
我在服务器上收到以下ProtocolException
:
需要流安全性 http://www.w3.org/2005/08/addressing/anonymous,但没有安全保障 上下文是谈判的。这可能是由远程端点引起的 缺少来自其绑定的StreamSecurityBindingElement。
服务器配置如下:
<system.serviceModel>
<bindings>
<netNamedPipeBinding>
<binding name="NetNamedPipeBinding_IWordDuplexCommunicationService" closeTimeout="00:01:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:30:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="204003200" maxConnections="10" maxBufferSize="204003200" maxReceivedMessageSize="204003200">
<readerQuotas maxDepth="204003200" maxStringContentLength="204003200" maxArrayLength="204003200" maxBytesPerRead="204003200" maxNameTableCharCount="204003200" />
<security mode="Transport">
<transport protectionLevel="EncryptAndSign" />
</security>
</binding>
</netNamedPipeBinding>
</bindings>
<extensions>
<behaviorExtensions>
<add name="sessionToken" type="Agn.Infrastructure.Security.Session.JSessionBehaviorElement, Agn.Infrastructure.Security" />
</behaviorExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior name="returnFaults">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="false" />
<dataContractSerializer maxItemsInObjectGraph="204003200" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="sessionToken">
<sessionToken />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="Agn.Shell.Services.AgnService">
<endpoint address="net.pipe://localhost/agnService" binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IWordDuplexCommunicationService" contract="Agn.Shell.Services.IAgnService" />
</service>
</services>
代码就像这样简单:
[ServiceContract]
public interface IAgnService
{
[OperationContract]
PageWrapper<Callejero> GetListCallejero(FiltroCallejero filter, PageWrapper page);
}
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.Single, MaxItemsInObjectGraph = WellKnownGeneralConstants.ImagnaMaxItemsInObjectGraph)]
public class AgnService : IAgnService
{
private readonly ICallejeroService callejeroService;
public AgnService(ICallejeroService callejeroService)
{
this.callejeroService = callejeroService;
}
public PageWrapper<Callejero> GetListCallejero(FiltroCallejero filter, PageWrapper page)
{
return this.callejeroService.GetList(filter, page) as PageWrapper<Callejero>;
}
}
启动代码:
public void StartupService()
{
this.agnServiceHost = new ServiceHost(this.Container.Resolve<IAgnService>());
this.agnServiceHost.Open();
}
任何提示?