为Azure Application Insights启用实时指标流

时间:2018-08-09 09:45:38

标签: azure azure-application-insights

我正在使用Azure应用程序见解监视本地IIS Web应用程序,但是当我检查实时指标流时,我可以注意到它无法正常工作,如以下figure

所示

结果,我尝试使用以下PowerShell Cmdlet安装Microsoft.ApplicationInsights块:

Install-Package Microsoft.ApplicationInsights -Version 2.7.1

但是不幸的是,它不起作用,并且出现以下错误:

Install-Package : A parameter cannot be found that matches parameter name 'Version'.

考虑到该版本已存在,我已经尝试将其与其他版本一起使用。

2 个答案:

答案 0 :(得分:0)

也许您位于防火墙或代理之后。 将以下内容添加到您的.config中:

public class Stack {

    private int position, capacity;
    private char[] stack;

    public Stack(int n) {
        capacity = n;
        position = -1;
        stack = new char[capacity];
    }

    public void push(char obj) {
        // stack is not full
        position++;
        stack[position] = obj;
    }

    public char pop() {
        // stack is not empty
        char temp = stack[position];
        position--;
        return temp;
    }

    public boolean isEmpty() {
        return position == -1;
    }

    public char peek() {
        return stack[position];
    }

    public boolean isFull() {
        return position == capacity - 1;
    }

}


public class Palindrome {

    public boolean same(char ch1, char ch2) {
        return (ch1 == ch2) ? true : false;
    }

    public boolean palindrom(String s) {
        int len = s.length();
        char token = 0;
        Stack stack = new Stack(len);

        for (int i = 0; i < len; i++) {
            token = s.charAt(i);
            if (token != ' ')
                stack.push(new Character(token));

        }

        for (int j = 0; j < len; j++) {
            token = s.charAt(j);
            if (token != ' ')
                if (!same((Character) (stack.pop()), s.charAt(j)))
                    return false;
        }

        return (stack.isEmpty()) ? true : false;
    }

    public String reverse(String original) {
        String reverse = "";
        int length = original.length();

        for (int i = length - 1; i >= 0; i--)
            reverse = reverse + original.charAt(i);

        return reverse;
    }

    public static void main(String[] a) {
        Palindrome s = new Palindrome();        
        System.out.println( s.palindrom(a[0]) ? "Palindrome" : "Not Palindrome");               
    }
}

请检查您在ApplicationInsights.config中是否具有以下条目:

  <system.net>
    <defaultProxy useDefaultCredentials="true">
      <proxy usesystemdefault="True" autoDetect="True" proxyaddress="http://ip.address.of.your.proxy" />
    </defaultProxy>
  </system.net>

<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector"/> 节点中。

<TelemetryModules>

<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryProcessor, Microsoft.AI.PerfCounterCollector"/> 节点中。

答案 1 :(得分:0)

在应用程序中安装Microsoft.ApplicationInsights.AspNetCore软件包,您应该能够在实时指标流中看到AppInsights。