问题描述
打印做错误
尝试通过安全透明方法``BarcodeScanner.getpixelbrightness(System.Drawing.Imaging.BitmapData,System.Drawing.Imaging.PixelFormat,Int32,Int32)''访问安全关键方法``System.Runtime.InteropServices.Marshal.ReadByte( IntPtr,Int32)''失败.
说明:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.
异常详细信息:System.MethodAccessException:通过安全透明方法"BarcodeScanner.getpixelbrightness(System.Drawing.Imaging.BitmapData,System.Drawing.Imaging.PixelFormat,Int32,Int32)"尝试访问安全关键方法"System.Runtime" .interopServices.Marshal.ReadByte(IntPtr,Int32)''失败.
print do erro
Attempt by security transparent method ''BarcodeScanner.getpixelbrightness(System.Drawing.Imaging.BitmapData, System.Drawing.Imaging.PixelFormat, Int32, Int32)'' to access security critical method ''System.Runtime.InteropServices.Marshal.ReadByte(IntPtr, Int32)'' failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MethodAccessException: Attempt by security transparent method ''BarcodeScanner.getpixelbrightness(System.Drawing.Imaging.BitmapData, System.Drawing.Imaging.PixelFormat, Int32, Int32)'' to access security critical method ''System.Runtime.InteropServices.Marshal.ReadByte(IntPtr, Int32)'' failed.
推荐答案
Private Sub carregaimagembarras()
Dim Bitmapcaminhoimagem As String = imagebarcode.ImageUrl ' carrega a imgem na variavel
Dim originalImage As New System.Drawing.Bitmap(Server.MapPath(Bitmapcaminhoimagem)) ' converte a imagem em System.Drawing.Bitmap
If Not Me.imagebarcode.ImageUrl Is Nothing Then
Dim barcodes As New System.Collections.ArrayList
Dim dtStart As DateTime = DateTime.Now
Dim iScans As Integer = 100
BarcodeScanner.FullScanPage(barcodes, originalImage, iScans, BarcodeScanner.BarcodeType.All)
' Show the results in a message box
ShowResults(dtStart, iScans, barcodes)
End If
End Sub
Private Sub ShowResults(ByVal dtStart As DateTime, ByVal iScans As Integer, ByRef barcodes As System.Collections.ArrayList)
Dim message As String = ""
If barcodes.Count > 0 Then
Dim bc As Object
For Each bc In barcodes
Message += bc & vbNewLine
Next
Else
Message += "Failed to find a barcode."
End If
txtcodigobarras.Text = Message
End Sub
这篇关于如何运行在普通服务器trut中使用低安全级别的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!