如何调用其他类静态方法静态

时间:2018-02-23 08:40:59

标签: wcf wcf-binding wcf-security

我想调用其他类方法但它显示错误。我的其他类是静态类和静态方法,请帮我解释一下如何解决这个错误。当编译器UHRCryptoManager显示上面的错误时

  

{"' UHRServices.Manager.UHRCryptoManager'的类型初始值设定项   抛出异常。"}

     

Service1.svc

public class Service1 : System.Web.Services.WebService , IService1
{
   public UHRResponse RequestApiToken(string CallerId)
   {
       UHRResponse response = new UHRResponse();

       if (!String.IsNullOrEmpty(CallerId))
       {
            if (CallerId.Length >= 15 && CallerId.Length <= 32)
            {
                string UserAgent = Context.Request.Browser.Platform;
                string ip = GetUserIP();

                string ApiToken = UHRCryptoManager.GenerateApiToken("sadassdasdasdsadsd", "WinNT", "::1", 636549893023357954);
                return response;
            }
        }
    }
}
other class
public static class UHRCryptoManager
{
    public static string GenerateApiToken(string callerid, string userAgent,string callerip, long ticks)
    {
        string hash = string.Join(":", new string[] { callerid, userAgent, ticks.ToString() , callerip });
    }
}

0 个答案:

没有答案