服务器无法处理请求。 --->授权标头为空

时间:2016-09-18 05:02:47

标签: c# asp.net web-services

我在.net framework 2.0中使用asmx web服务,我使用此代码来调用服务

import graph_tool.all as gt
dist = gt.shortest_distance(G)
ave_path_length = sum([sum(i) for i in dist])/(G.num_vertices()**2-num_vertices())

但是会收到此错误

try
            {
                edu.sharif.hokm.Employee em = new edu.sharif.hokm.Employee();

                CredentialCache credentialCache = new CredentialCache();
                NetworkCredential credentials = new
                   NetworkCredential("user", "pass");
                credentialCache.Add(new Uri(em.Url),
                                    "Basic", credentials);
                em.Credentials = credentialCache;
                em.PreAuthenticate = true;

                DataTable dt = em.GetEmployee("1000");

                MessageBox.Show(dt.Rows.Count.ToString());
            }
            catch(Exception ex)
            {

            }

0 个答案:

没有答案