对WCF服务的应用洞察

时间:2019-03-12 19:38:46

标签: azure wcf azure-application-insights

我正在尝试配置Winforms应用程序以调用wcf服务。 由于该错误发生在azure托管的wcf服务上,因此我希望应用程序见解可以对我有所帮助。

      These are the steps I followed
        An official link from Microsoft on how to add Application Insights to a Windows Forms application. From the link:

        In Azure - portal.azure.com

        Create an Application Resource. ::New / Developer Services / Application Insights.
        Notice the instrumentation key generated, grab a copy and set it aside, we'll need it when we configure your application.
        In Your Application

        NuGet - Add 'Application Insights API'

    <ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings" schemaVersion="2014-05-30">
        <TelemetryChannel>
            <DeveloperMode>false</DeveloperMode>
        </TelemetryChannel>
        <TelemetryModules>
            <Add Type="Microsoft.ApplicationInsights.Tracing.DiagnosticsTelemetryModule, Microsoft.ApplicationInsights"/>
        </TelemetryModules>
        <InstrumentationKey>**

your-instrumentation-key-guid**</InstrumentationKey>
</ApplicationInsights>

我想这是我迷路的地方。该服务是从winforms应用程序调用的。 WCF服务的端点位于winforms客户端的app.config中。端点如何知道如何使用应用程序见解。 我还需要https吗?

AfterReceiveRequest的工作日志                1df55aaa-0208-4a6f-820b-fb7efc12484d                                 2019-03-13T14:54:53.344Z             2019-03-13T14:59:53.344Z                                   用户             密码                             https://workingVMerver/Services/2019/Image.svc         http://test.com/ws/DocImgSrch              

非工作日志:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <s:Header>
    <ActivityId CorrelationId="8047fce6-2567-4cbb-b3d9-a0ece3e9199c" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">d9377396-bdd0-48d7-b9a5-d1b6e2ff8a85</ActivityId>
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <u:Timestamp u:Id="_0">
        <u:Created>2019-03-13T13:54:47.899Z</u:Created>
        <u:Expires>2019-03-13T13:59:47.899Z</u:Expires>
      </u:Timestamp>
      <o:UsernameToken u:Id="uuid-f0319ed1-aac2-4768-9d1c-e1dec7598bf1-1">
        <o:Username>userr</o:Username>
        <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</o:Password>
      </o:UsernameToken>
    </o:Security>
    <To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://nonworkingvmv1/Services/2019/Image.svc</To>
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://jackhenry.com/ws/DocImgSrch</Action>
</s:Header>

两者都是https请求,但是在无效的情况下,一个SSL无法识别,并且标头引发错误

   <binding name="httpsCertificateBinding" closeTimeout="01:01:00"
          openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646">
              <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"
                maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
           <security mode="TransportWithMessageCredential">
             <message clientCredentialType="UserName"/>
             <transport clientCredentialType="None"></transport>
           </security>
        </binding>

    <service behaviorConfiguration="DefaultBehavior" name="Services.Image">    
         <endpoint address="" binding="basicHttpBinding" bindingConfiguration="httpCertificateBinding" name="BasicHttpEndPoint" contract="Services.Interfaces.IImage" />

            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="httpsCertificateBinding"  bindingNamespace="http://jackhenry.com/jxchange/TPG/2008" contract="Services.Interfaces.IImage" />

           <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
           <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
          </service>

 <serviceBehaviors>
        <behavior name="DefaultBehavior">
         <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
  <serviceDebug includeExceptionDetailInFaults="true" />
      <PfRequestOutputBehaviorExtensionElement/>
         <serviceCredentials>
             <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Services.CustomMembershipProvider,Services"/>
          </serviceCredentials>
         <useRequestHeadersForMetadataAddress />

         </behavior>

它具有相同的行为..但ssl不适用于有故障的行为。验证程序不会被调用。而且该服务会引发无法理解mustunderstand = 1

的错误

请求中唯一的区别是 在故障之一。即使我呼叫https,但这里的网址仍采用http    http://nonworkingVm/Services/2019/Image.svc

工作中的https   https://workingvm/Services/2019/Image.svc

SSL在网关级别处理。 Azure应用程序网关将http请求重定向到https。我要做的只是在VM上设置WCF配置以指定https绑定。我不是在iis上“要求ssl”。无效的URl是https,但是WSDl说http。我不知道为什么即使配置了所有绑定后也会这么说。我从未与天青合作过。

我还尝试了ValidateMustUnderstand = false。这使它抛出

 Security processor was unable to find a security header in the message. 
This might be because the message is an unsecured fault or because there is a binding mismatch between the communicating parties.  
This can occur if the service is configured for security and the client is not using security

关闭了验证设置的响应如下所示。显然没有动作必须了解标头

<s:Header>
<ActivityId CorrelationId="d2fbd200-01e1-4657-b35a-b583be38341a" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">00000000-0000-0000-0000-000000000000</ActivityId>
</s:Header>

0 个答案:

没有答案