저는 이틀 동안이 문제를 해결하기 위해 노력하고 있습니다.IIS에서 호스팅되는 ASP.NET 웹 응용 프로그램에서 WCF 콜백 서비스를 수신합니다.
문제는 3 가지 작동 부품이 있습니다. ASP.NET 사이트, WCF IIS 호스팅 서비스 및 WPF xbap 응용 프로그램이 있습니다.
내가하려는 것은 ASP.NET 사이트의 변수를 WPF xbap 앱에 전달하는 것입니다. 그래서 wsDualHttpBinding을 가진 WCF 서비스를 설정하고 콜백을 사용하여 ASP.NET과 xbap에 알립니다.
이제 우리 서버의 IIS 6에서 WCF 서비스를 호스팅하고 로컬로 VS2012 iisexpress 및 xbap에서 ASP.NET 호스팅을 실행합니다. 그것은 잘 작동합니다. 그러나 우리 서버의 IIS 6에 ASP.NET 사이트를 게시하자마자 콜백은 ASP.NET 응용 프로그램에서 수신되지 않습니다. 둘 다 응용 프로그램 풀에 있습니다.
ASP.NET이 콜백 수신 대기 포트를 열어두기 위해 필요한 설정이 있습니까? XBAP은 여전히 콜백을 받지만 아무런 문제가 없습니다. 다음과 같이
서비스 설정은 다음과 같습니다
<configuration>
<system.diagnostics>
<sources>
<source propagateActivity="true" name="System.ServiceModel" switchValue="Warning,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="web_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
</system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding receiveTimeout="00:01:00" sendTimeout="00:00:05" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false"
multipleSiteBindingsEnabled="false" />
<protocolMapping>
<add scheme="http" binding="wsDualHttpBinding" />
</protocolMapping>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
이 서비스는 고객이 콜백리스트에 가입 할 방법이있다 (나는 그것을 배제하기 때문에 순간 단순의 버퍼를 끝나가는 한주의). 그런 다음 메소드는 콜백을 호출하기 위해 목록을 통해 증가합니다.
[ServiceContract(CallbackContract = typeof(IClientCallback))]
public interface IVisualisationService
{
[OperationContract(IsOneWay = true)]
void SubscribeToRedenderHoles(string address);
[OperationContract(IsOneWay = true)]
void SubscribeToEditSelectedHoles(string address);
[OperationContract(IsOneWay = true)]
void SubscribeToShowHoles(string address);
[OperationContract(IsOneWay = true)]
void RedenderHoles(Hole3D[] holes, string address, int channelhashcode);
[OperationContract(IsOneWay = true)]
void EditSelectedHoles(Guid[] holesIds, string address);
[OperationContract(IsOneWay = true)]
void ShowHoles(string address);
}
public interface IClientCallback
{
[OperationContract(IsOneWay = true)]
void OnRenderHoles(Hole3D[] holes);
[OperationContract(IsOneWay = true)]
void OnEditSelectedHoles(Guid[] holesIds);
[OperationContract(IsOneWay = true)]
void OnShowHoles(int channelhashcode);
}
다음은 WCF 서비스 헤더입니다. 필자는이 메서드를 사용하지 않습니다. 은 ASP.NET 클라이언트의 web.config
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IVisualisationService" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://hims.mecha.com/VisualisationWcfService/VisualisationService.svc"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IVisualisationService"
contract="VisualisationServiceReference.IVisualisationService"
name="WSDualHttpBinding_IVisualisationService" />
</client>
</system.serviceModel>
에 대한
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class VisualisationService : IVisualisationService
{
이제 그런 다음 XBAP 응용 프로그램 클라이언트는
내가 추가 서비스 참조 방법을 사용하고 두 클라이언트에서<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IVisualisationService" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://hims.mecha.com/VisualisationWcfService/VisualisationService.svc"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IVisualisationService"
contract="VisualisationService.IVisualisationService" name="WSDualHttpBinding_IVisualisationService" />
</client>
</system.serviceModel>
</configuration>
을의 app.config WCF를 ASP.NET 및 XBAP 프로젝트에 모두 추가합니다. 두 클라이언트 모두 코드를 가지고 있고 각 콜백에 대한 메서드를 처리하도록 설정했습니다.
sealed class VisualisationManager : VisualisationService.IVisualisationServiceCallback
나는 그것이 약간 길게 보인다는 것을 알고 있지만, 나는 가능한 한 그 문제에 관해 많이 보여주고 싶었다. 그것은 로컬하지만 잘 작동하는 이유 IIS에서 호스팅 때 완전히 소실하고 6
OperationContext.Current와 같은 컨텍스트 개체를 사용하여 IsOneWay = true로 표시된 계약이 있습니까? 또한 IsOneWay를 false로 설정하여 호출이 예상대로 작동합니까? –