Проблема с прослушиванием на конечной точке, подключающейся к WCF по протоколу net .tcp - PullRequest
0 голосов
/ 09 мая 2020

Эта странная ошибка появлялась за день до публикации этого сообщения. Раньше он работал нормально, но не сейчас.

При одном движении перезапуска системы ошибка исчезает и появляется возможность получить доступ к приложению.

и после повторной перезагрузки системы начинает появляться ошибка не зная причины root.

Включенные протоколы: net.tcp,http

Я смог просмотреть ссылку ниже

Вот фрагмент ниже, который вызывает исключение

objCheckUserLoginResponse = AuthenticationManagerClient.Check(objCheckUserLoginRequest, objCustomer);

Исключение:

The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/TAServices/AuthenticationManager.svc' is unavailable for the protocol of the address. 
System.ServiceModel.EndpointNotFoundException: The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/TAServices/AuthenticationManager.svc' is unavailable for the protocol of the address.

Server stack trace: 
   at System.ServiceModel.Channels.ConnectionUpgradeHelper.DecodeFramingFault(ClientFramingDecoder decoder, IConnection connection, Uri via, String contentType, TimeoutHelper& timeoutHelper)
   at System.ServiceModel.Channels.StreamedFramingRequestChannel.SendPreamble(IConnection connection, TimeoutHelper& timeoutHelper, ClientFramingDecoder decoder, SecurityMessageProperty& remoteSecurity)
   at System.ServiceModel.Channels.StreamedFramingRequestChannel.StreamedConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
   at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
   at System.ServiceModel.Channels.StreamedFramingRequestChannel.StreamedFramingRequest.SendRequest(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at TA.ServiceProxy.AuthenticationManager.IAuthenticationManager.Check(CheckUserLoginRequest1 request)
   at TA.ServiceProxy.AuthenticationManager.AuthenticationManagerClient.TA.ServiceProxy.AuthenticationManager.IAuthenticationManager.Check(CheckUserLoginRequest1 request) in D:\2017_TFS\TestandAssessment\Dev\Manifest\TestPrepAdmin\ServiceProxy\Service References\AuthenticationManager\Reference.cs:line 3370
   at TA.ServiceProxy.AuthenticationManager.AuthenticationManagerClient.Check(CheckUserLoginRequest Request, Customer Customer) in D:\2017_TFS\TestandAssessment\Dev\Manifest\TestPrepAdmin\ServiceProxy\Service References\AuthenticationManager\Reference.cs:line 3377
   at TA.UIFrameWork.AuthenticationManagement.AuthenticateUser(CheckUserLoginRequest objCheckUserLoginRequest) in D:\2017_TFS\TestandAssessment\Dev\Manifest\TestPrepAdmin\UIFrameWork\Authentication\AuthenticationManagement.cs:line 19
 T: 2020-05-09 12:19:52,242 |L: INFO |TH: 8 |L: Utilities.PageBase |MSG: 
SessionID:  Method: LoadLanguages
Info: Page: Login.aspx Method: LoadLanguages Enters

AuthenticationManagement.cs

using TA.ServiceProxy.AuthenticationManager;
using System;

namespace TA.UIFrameWork
{
    public class AuthenticationManagement
    {
        public CheckUserLoginResponse AuthenticateUser(CheckUserLoginRequest objCheckUserLoginRequest)
        {
            Customer objCustomer;
            CheckUserLoginResponse objCheckUserLoginResponse = null;
            try
            {
                objCustomer = new Customer();
                objCustomer.CustomerName = "ABC";
                objCustomer.CultureInfo = "English";
                AuthenticationManagerClient AuthenticationManagerClient = new AuthenticationManagerClient();
                AuthenticationManagerClient.Open();
                objCheckUserLoginResponse = AuthenticationManagerClient.Check(objCheckUserLoginRequest, objCustomer);
                AuthenticationManagerClient.Close();
                AuthenticationManagerClient = null;
                objCustomer = null;
                objCheckUserLoginRequest = null;
            }
            catch (Exception ex)
            {
                LoggingFramework.log.Error(ex.Message, ex);
            }
            return objCheckUserLoginResponse;
        }
      }
    }
}

web.config

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data" />
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    <section name="dns" type="System.Configuration.NameValueFileSectionHandler" />
  </configSections>
  <dataConfiguration defaultDatabase="LocalSqlServer" />
  <dns file="dns.config" />
  <system.web>
    <!-- Web Part -->
    <membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" applicationName="/MVCFramework" />
      </providers>
    </membership>
    <profile enabled="true" defaultProvider="TableProfileProvider">
      <providers>
        <clear />
        <add name="TableProfileProvider" type="Microsoft.Samples.SqlTableProfileProvider" connectionStringName="LocalSqlServer" table="aspnet_Profile" applicationName="/MVCFramework" />
      </providers>
    </profile>
    <!-- End Web Part -->

    <pages validateRequest="false" enableEventValidation="false" enableViewStateMac="false" maintainScrollPositionOnPostBack="false" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
      <controls>
        <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit" />
      </controls>
    </pages>
    <customErrors mode="Off">
      <error statusCode="403" redirect="Status.aspx" />
      <error statusCode="404" redirect="Status.aspx" />
    </customErrors>
    <httpCookies httpOnlyCookies="true">
    </httpCookies>
    <trace enabled="false" localOnly="true">
    </trace>
    <httpRuntime maxRequestLength="2097151" executionTimeout="220000" requestValidationMode="2.0" />
    <!-- 
            Set compilation debug="false" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only  
            during development.
        -->
    <compilation debug="true" defaultLanguage="c#" targetFramework="4.0">
      <assemblies>
      </assemblies>
      <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </buildProviders>
    </compilation>
    <sessionState mode="InProc" timeout="6000" cookieless="UseCookies">
    </sessionState>
    <authorization>
      <allow users="?" />
    </authorization>

    <httpHandlers>
      <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
      <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
    </httpHandlers>
  </system.web>
  <system.net>
    <settings>
      <servicePointManager expect100Continue="false" />
    </settings>
  </system.net>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1024000000"></requestLimits>
      </requestFiltering>
    </security>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <remove name="ChartImageHandler" />
      <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </handlers>
    <modules>
      <add name="QueryStringValidation" type="Presentation.Utilities.QueryStringValidation" />
    </modules>
  </system.webServer>

  <system.data>
    <DbProviderFactories>
      <remove invariant="MySql.Data.MySqlClient" />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.3.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_Framework" closeTimeout="00:50:00" openTimeout="00:50:00" receiveTimeout="00:50:00" sendTimeout="00:50:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="999999999" maxBufferPoolSize="524288" maxReceivedMessageSize="999999999" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="999999999" maxArrayLength="999999999" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None"/>
        </binding>
      </basicHttpBinding>
      <netTcpBinding>
        <binding name="NetTcpBinding_Framework" closeTimeout="00:50:00" openTimeout="00:50:00" receiveTimeout="00:50:00" sendTimeout="00:51:00" transactionFlow="false" transferMode="Streamed" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="999999999" maxBufferSize="999999999" maxConnections="10" maxReceivedMessageSize="999999999">
          <readerQuotas maxDepth="32" maxStringContentLength="999999999" maxArrayLength="999999999" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:50:00" enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
            <message clientCredentialType="Windows" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
   <client>
      <endpoint address="net.tcp://localhost/TAServices/AccountManager.svc" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_Framework" contract="AccountManager.IAccountManager" name="NetTcpBinding_Framework" />
  </client>
    <behaviors>
      <endpointBehaviors>
        <behavior name="ClientBehavior">
          <dataContractSerializer maxItemsInObjectGraph="10000000" />
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>
  <location path="Common">
    <system.web>
      <authorization>
        <allow users="?" />
      </authorization>
    </system.web>
  </location>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="5000000" />
      </webServices>
    </scripting>
  </system.web.extensions>
</configuration>

Не зная причины, я ничего не мог сделать. Пожалуйста, предложите в решении проблемы EndpointNotFoundException по коду или из windows 10 (1903)

Ответы [ 2 ]

1 голос
/ 11 мая 2020

Я решил эту проблему, выпустив OneApp.IGCC.WinService.exe, который занимал порт 808 после того, как было инициировано обновление драйвера графики Intel®. Но это звучит странно, поэтому проверьте, входит ли SMSvcHost.exe в список порта 808.

C:\Windows\system32>netstat -ano | find "808"
  TCP    0.0.0.0:808            0.0.0.0:0              LISTENING       4356
  TCP    [::]:808               [::]:0                 LISTENING       4356

Если нет, выполните команду TASKKILL /F /PID <ProcessId> из приглашения с повышенными правами. Итак, в моем случае

C:\Windows\system32>netstat -ano | find "808"
  TCP    0.0.0.0:808            0.0.0.0:0              LISTENING       5068
  TCP    [::]:808               [::]:0                 LISTENING       5068

C:\Windows\system32>tasklist | find "5068"
OneApp.IGCC.WinService.ex     5068 Services                   0     36,632 K

C:\Windows\system32>taskkill /F /PID 5068
SUCCESS: The process with PID 5068 has been terminated.

C:\Windows\system32>netstat -ano | find "808"


C:\Windows\system32>

Затем перезапустите Net.Tcp Port Sharing Service с services.msc

Даже после перезагрузки системы OneApp.IGCC.WinService.exe переопределит SMSvcHost.exe, прослушивая 808 порт. Итак, отключите запуск Intel(R) Graphics Command Center Service (C:\Windows\System32\DriverStore\FileRepository\igcc_dch.inf_amd64_26b207b939eae50e) из services.msc

0 голосов
/ 11 мая 2020

Похоже, вы размещаете проект службы WCF в IIS и пытаетесь заставить его работать с HTTP и Nettcp. Чтобы заставить его работать по протоколу NetTcp, мы должны включить определенные функции Windows и привязку NetTcp в модуле привязки сайта IIS. Кроме того, мы должны настроить конечную точку службы с Nettcpbinding, которая не настроена в вашем файле Webconfig. Пожалуйста, подумайте о замене раздела System.servicemodel приведенной ниже конфигурацией.

<system.serviceModel>
        <services>
            <service name="WcfService1.Service1">
                <endpoint address="service1" binding="basicHttpBinding" contract="WcfService1.IService1" ></endpoint>
                <endpoint address="service2" binding="netTcpBinding"  contract="WcfService1.IService1"></endpoint>
                <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"></endpoint>
            </service>
        </services>
        <bindings>
            <basicHttpBinding>
                <binding>
                    <security mode="Transport">
                        <transport clientCredentialType="None"></transport>
                    </security>
                </binding>
            </basicHttpBinding>
            <netTcpBinding>
                <binding>
                    <security mode="None"></security>
                </binding>
            </netTcpBinding>
        </bindings>
        <behaviors>
            <serviceBehaviors>
                <behavior>
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    </system.serviceModel>

Для поддержки протокола Net .tcp в IIS включите следующую функцию windows. https://i.stack.imgur.com/15e3G.png
Затем добавьте поддержку Net .tcp на веб-сайт.
https://i.stack.imgur.com/LM9jv.png
Наконец, добавьте привязку к сайту с помощью net Протокол .tcp. Обратите внимание, что 808 - это порт по умолчанию для протокола net .tcp. Не используйте номер порта, уже используемый другим веб-сайтом.
https://i.stack.imgur.com/0yVz4.png
См. Ссылку ниже.
Не удалось найти базовый адрес, соответствующий схеме net .tcp для конечной точки с привязкой NetTcpBinding. Схемы базовых адресов: [http]
Не стесняйтесь сообщить мне, существует ли проблема.

...