问题描述
测试代码如下:publicvoidBindData(){stringUrl="https://api.mch.weixin.qq.com/secapi/mch/submchmanage?action=add";Encodingencoding=Encoding.UTF8;varxml="<?xmlversion='1.0'encoding='utf-8'?><xml><appid>wxd9c866ad31c3c6da</appid><mch_id>310330850215003</mch_id><sign>1460169A8156FCE2516E98E33D23079C</sign><merchant_name>测试商户</merchant_name><merchant_shortname>测试商户</merchant_shortname><service_phone>05708010890</service_phone><business>001059164</business><merchant_remark>方法烦烦烦</merchant_remark><nonce_str>714f2f2156f5f463a6735481409a068d</nonce_str></xml>";HttpWebResponseresponse=HttpWebResponseUtility.CreatePostHttpResponse(Url,xml,1000000,null,encoding,null);}
publicstaticHttpWebResponseCreatePostHttpResponse(stringurl,stringxml,int?timeout,stringuserAgent,EncodingrequestEncoding,CookieCollectioncookies){if(string.IsNullOrEmpty(url)){thrownewArgumentNullException("url");}if(requestEncoding==null){thrownewArgumentNullException("requestEncoding");}HttpWebRequestrequest=null;//如果是发送HTTPS请求if(url.StartsWith("https",StringComparison.OrdinalIgnoreCase)){ServicePointManager.ServerCertificateValidationCallback=newRemoteCertificateValidationCallback(CheckValidationResult);request=WebRequest.Create(url)asHttpWebRequest;request.ProtocolVersion=HttpVersion.Version10;}else{request=WebRequest.Create(url)asHttpWebRequest;}request.Method="POST";request.ContentType="application/x-www-form-urlencoded";request.KeepAlive=false;if(!string.IsNullOrEmpty(userAgent)){request.UserAgent=userAgent;}else{request.UserAgent=DefaultUserAgent;}if(timeout.HasValue){request.Timeout=timeout.Value;}if(cookies!=null){request.CookieContainer=newCookieContainer();request.CookieContainer.Add(cookies);}//如果需要POST数据if(xml.NoNullOrWhiteSpace()){byte[]data=requestEncoding.GetBytes(xml.ToString());using(Streamstream=request.GetRequestStream()){stream.Write(data,0,data.Length);stream.Close();}}returnrequest.GetResponse()asHttpWebResponse;}
网上报这个错误的方法基本都试过了,有大神知道什么原因吗
解决方案
解决方案二:
商户注册,是不是需要证书?
解决方案三:
引用1楼故乡山川的回复:
商户注册,是不是需要证书?
商户注册是不要证书的,交易的时候才有证书验证
解决方案四:
不清楚,没搞过商户注册,帮楼主顶一下。之前我弄的是微信公众号。好像和楼主不是一个概念
解决方案五:
引用3楼hanjun0612的回复:
不清楚,没搞过商户注册,帮楼主顶一下。之前我弄的是微信公众号。好像和楼主不是一个概念
和微信公众号不一样的
解决方案六:
没有人用过么