WCF 타이밍 Windows 서비스에서 타이밍이지만 웹 응용 프로그램은 아닙니다.
-
03-07-2019 - |
문제
안녕하세요
현재 Windows 서비스에서 WCF 서비스를 호출하는 데 문제가 있습니다. 내 응용 프로그램 솔루션은 다음과 같습니다.
- 웹 관리 콘솔 (웹 프로젝트)
- 중앙 제어 (Windows Service)
- 웹 관리 콘솔이 연결하여 구성 할 수 있도록 WCF 서비스
- 노드에서 WCF를 사용하는 여러 통화 (창 서비스)
- 노드 (Windows 서비스)
- Central Control Windows 서비스가 구성 할 수 있도록 WCF 서비스
웹 관리 콘솔은 중앙 제어 WCF에 액세스 할 수 있지만 중앙 제어 시간은 노드에 연결하려고 할 때가 있습니다. 이 테스트에서 나는 각 서비스의 인스턴스를 생성하고 각 Windows 서비스에서 WCF 기능을 사용하는 몇 개의 버튼이있는 간단한 Windows Form 프로젝트 인 런처 앱을 만들었습니다 (실패한 점을 확인)이 런처 앱 Windows 서비스 중 하나와 대화 할 수 없었습니다. 이것은 혼란스러워서 웹 관리 콘솔의 웹 양식에 동일한 버튼을 추가했으며 WCF를 통해 두 Windows 서비스에 완벽하게 연결되었습니다. 나는 WCF 재료가 IE를 통해 그것을 치고 훌륭한 XML을 모두 볼 수 있으므로 작동한다는 것을 알고 있습니다 (그리고 웹 앱의 통화가 작동한다는 사실은 그것이 UP가 진행되고 실행되고 있음을 나타냅니다).
요컨대 내 웹 앱은 Windows 서비스에서 WCF 서비스를 사용할 수 있지만 Windows 양식 및 Windows 서비스는 할 수 없습니다. 왜 이런거야!?
나는이 프로젝트에서 이미 시간이 거의 없어서 Speedy Replies가 굉장 할 것입니다!
기술/코드 세부 사항응용 프로그램에서 구성 파일을 사용하지 않습니다. 모든 것이 코드를 통해 만들어지고 있으며 동일한 코드를 사용하여 WCF가 어디에서나 호출하도록했습니다. 또한 문제가 될 경우를 대비하여 보안을 어디에서나 끄려고 노력했습니다. 또한 나는 같은 것을 사용하고 있습니다 svcutil 일관성을 유지하기 위해 모든 곳에서 생성 된 프록시 파일
노드 호출의 예
Dim Bind As New WSHttpBinding(SecurityMode.None, True)
Bind.CloseTimeout = New TimeSpan(0, 0, 10)
Bind.OpenTimeout = New TimeSpan(0, 0, 10)
Bind.SendTimeout = New TimeSpan(0, 0, 10)
Dim client As New BN.BNodeServiceClient(Bind, New EndpointAddress("http://localhost:27374/Node"))
client.sendMessage("Test Message")
client.Close()
노드가 WCF를 열었습니다
BNodeHost = New ServiceHost(GetType(iBNodeService))
BNodeHost.AddServiceEndpoint(GetType(BNodeService), New WSHttpBinding(SecurityMode.None, True), New Uri("http://localhost:27374/Node"))
Dim metadataBehavior As ServiceModel.Description.ServiceMetadataBehavior
metadataBehavior = BNodeHost.Description.Behaviors.Find(Of _
ServiceModel.Description.ServiceMetadataBehavior)()
If metadataBehavior Is Nothing Then
metadataBehavior = New ServiceModel.Description.ServiceMetadataBehavior()
metadataBehavior.HttpGetEnabled = True
metadataBehavior.HttpGetUrl = New Uri("http://localhost:27374/Node")
BNodeHost.Description.Behaviors.Add(metadataBehavior)
Else
BNodeHost.Description.Behaviors.Add(metadataBehavior)
End If
BNodeHost.Open()
이것은 다른 비트 적절한 Windows 서비스를 만들고 설치자를 추가하려고 시도하기 전에 모두 작동했습니다. 설치 프로그램은 정상적으로 작동하고 시작하여 모든 WCF XML을 IE에서 볼 수있는 서비스를 설치합니다.
당신이 말할 수 있듯이, 나는 WCF를 처음 접했고 이것은 그것을 사용하는 첫 번째 응용 프로그램입니다. 기본 비트는 구성 파일을 사용하지 않는 샘플의 복사/붙여 넣기/변경 작업입니다.
모든 도움은 대단히 감사하겠습니다.
해결책
AppConfig의 모든 엔드 포인트가 Admin WebApp의 WebConfig의 설정과 일치하는지 확인하십시오. 각각은 다양한 타임 아웃 값을 설정합니다.
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_ILookupService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="LargeEndpointBehavior">
<dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://localhost:59599/LookupService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ILookupService"
contract="FEEALookupServiceReference.ILookupService" name="WSHttpBinding_ILookupService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
도움이되기를 바랍니다. 행운을 빕니다.
다른 팁
나는 이것을 제대로 작동시킬 수 없었다. Windows 서비스에 Windows 서비스 통신에 문제가있는 것 같습니다. 어딘가에서 일어날 수있는 방법이 있지만 시간이 부족하여 비트 중 하나 (중앙 제어)를 일반 Windows 응용 프로그램으로 바꾸어 설치하여 해결했습니다. 잘 작동하고 고객은 행복합니다 :)
Windows 서비스가 실행중인 사용자에 대한 권한을 확인하십시오. 충분한 권한이없는 네트워크 서비스에 기본값을 원합니다. 올바른 권한을 가진 전용 사용자로 실행하십시오.
Windows 방화벽을 확인하십시오. 웹 연결 중 일부를 차단하는 것을 좋아합니다. 나는 보통 그냥 꺼집니다.