Shopify应用程序/无效的URI:无法解析主机名

时间:2018-07-26 06:54:33

标签: c# shopify shopify-app

我已经尝试解决了将近48个小时,但我似乎无法理解该问题,我的Install可以正常工作并正确加载。但是,当它重定向到Auth时,出现了一个疯狂的未找到错误(open image

分解代码后,我从Visual Studio中弹出一个消息,说“无效的URI:无法解析主机名”(open image

这是我的代码:

// GET: fulfillment
    public ActionResult Install(string shop, string signature, string timestamp)
    {
        string r = string.Format("https://{0}/admin/oauth/authorize?client_id={1}&scope=read_fulfillments,write_fulfillments&redirect_uri=https://{2}/fulfillment/Auth", shop, apiKey, appUrl);
        return Redirect(r);
    }



    public ActionResult Auth(string shop, string code)
    {
      string u = string.Format("https://{0}/admin/oauth/access_token", shop);

      var client = new RestClient(u);
      var request = new RestRequest(Method.POST){RequestFormat = DataFormat.Json};

       request.AddHeader("Content-Type", "application/json");
       request.AddParameter("application/x-www-form-urlencoded", "client_id=" + apiKey + "&client_secret=" + secretKey + "&code=" + code, ParameterType.RequestBody);

       var response = client.Execute(request);
       var r = JsonConvert.DeserializeObject<dynamic>(response.Content);
       var access = r.access_token;

        return View();
    }

任何帮助将不胜感激!我很想学习:D

0 个答案:

没有答案