C# GDI+;中发生一般性错误;。无法打印条形码

C# GDI+;中发生一般性错误;。无法打印条形码,c#,asp.net,visual-studio-2012,C#,Asp.net,Visual Studio 2012,我得到以下错误 [外部异常(0x80004005):GDI+中发生一般错误。] System.Drawing.Image.Save(字符串文件名、ImageCodeInfo编码器、EncoderParameters encoderParams)+813085 InventoryMS.PrintBarcodes.Page_Load(对象发送方,事件参数e)+766 System.Web.UI.Control.LoadRecursive()+71 System.Web.UI.Page.Process

我得到以下错误

[外部异常(0x80004005):GDI+中发生一般错误。] System.Drawing.Image.Save(字符串文件名、ImageCodeInfo编码器、EncoderParameters encoderParams)+813085 InventoryMS.PrintBarcodes.Page_Load(对象发送方,事件参数e)+766 System.Web.UI.Control.LoadRecursive()+71 System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+3178

下面是我的代码

%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PrintBarcodes.aspx.cs" Inherits="InventoryMS.PrintBarcodes" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title><link rel="stylesheet" href="css/bootstrap.min.css" />
        <link rel="stylesheet" href="css/font-awesome.css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="getCodetxt" runat="server" Visible="True"></asp:TextBox>
        <asp:Panel ID="pnlPrint" runat="server">
        <br />&nbsp;
          <% 

              int number = Convert.ToInt32(Session["val"].ToString());
              int t = 1;
              for (int i = 0; i < number; i++)
              {

              %>
            <div style="width:130px; height:99px; float:left; margin-left:17px;">
       <p style="text-align:center; margin-left:0px; margin-bottom:-17px; width:120px;font-size:11px">Testing     Company</p><br />
            <asp:Image ID="img" runat="server" Style="margin-bottom:12px;margin-left:-5px; height:43px; width:130px;"/><br />
                <p style="margin-top:-13px; font-size:10px; text-align:center">Size:<asp:Label ID="lblsize" runat="server" Text=""></asp:Label></p>
                </div>
          <% if (t == 2)
             {

                 t = 1;
                 %>
                 <br />&nbsp;
                 <%
             }
             else { t++; }
              }
              %>
              </asp:Panel>
    </div>
    </form>
</body>
</html>
%@Page Language=“C#”AutoEventWireup=“true”codebhind=“PrintBarcodes.aspx.cs”Inherits=“InventoryMS.PrintBarcodes”%%>

测试公司

大小:



请指导我解决此问题。

根据我的错误,此错误通常与文件路径有关。确保您试图保存到的文件夹存在,并且您具有写入权限。

您没有向我们提供有关问题的足够信息,也没有向我们提供实际失败的代码。你能提供打印条形码的代码和更详细的解释吗?谢谢Mikael Eliasson,你能告诉我怎么做吗?我被卡住了,自己找不到办法