在ms中运行良好,但在iis中发布时则不行 [英] run good in ms visual but not when publish in iis

查看:73
本文介绍了在ms中运行良好,但在iis中发布时则不行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在扫描图像并在图像控件中显示。当我遇到ms visual studio时运行良好但是当我在iis管理器上发布时它显示没有什么不能理解是什么问题..

请帮帮我

这是我的page_load



i'm ulpoading an image and showing in image control.it run good when i run into ms visual studio but when i publish on iis manager it shows nothing cant understand what is the problem..
please help me
this is my page_load

protected void Page_Load(object sender, EventArgs e)
      {
          //Session.Timeout = 90;

          string username = (string)(Session["UserAuthentication"]);
              if(Session["UserAuthentication"]!=null)
              {
                  Label2.Text = username;
                  //Get all the images stored in images directory
                  //string[] filePaths = Directory.GetFiles(Server.MapPath("Images/"));
                  //Search the image with same name as username
                 // string path = filePaths.AsEnumerable().Where(s => s.Contains(username)).First();
                  //Assign the path
                  //Image1.ImageUrl = path;
                  //Image1.ImageUrl = "Images/" + username;

                  string query = "SELECT imgpath FROM imagepath where imagename='" + username + "'";
                  con = new SqlConnection(connstring);
                  cmd = new SqlCommand(query, con);
                  SqlDataReader sdr;
                  con.Open();
                  sdr = cmd.ExecuteReader();
                  while (sdr.Read())
                  {
                      Image1.ImageUrl = sdr[0].ToString();
                  }
                  con.Close();



              }

推荐答案

首先要找出浏览器的原因无法加载图片。



大多数现代浏览器都有开发者工具,按F12即可访问。



这些工具具有网络跟踪。这将显示页面尝试加载的所有服务器资源。



查找图像并检查http状态代码。这个状态代码将是您的线索。
First thing is to find out why the browser can't load the image.

Most modern browsers have developer tools which can be access by pressing F12.

These tools have a network trace. This will show all the server resources the page tries to load.

Look for the image and check the http status code. This status code will be your clue.


这篇关于在ms中运行良好,但在iis中发布时则不行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆