没有可用的来源..浏览以查找来源

Posted

技术标签:

【中文标题】没有可用的来源..浏览以查找来源【英文标题】:No Source Available..Browse to find source 【发布时间】:2013-09-03 12:40:12 【问题描述】:

当我执行 vb.net 代码时..我得到以下错误。

没有可用的源代码。当前位置没有可用的源代码。 浏览以查找来源。

如何解决这个错误?

我无法浏览任何来源..它被禁用..

代码如下:

Private Sub ButtonProductAdvertisingAPIItemLookup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 处理 ButtonProductAdvertisingAPIItemLookup.Click sender.Enabled = False

    'Product Advertising API, ItemLookup: http://docs.aws.amazon.com/AWSECommerceService/2011-08-01/DG/ItemLookup.html

    Dim ItemId(9) As String

    ItemId(0) = System.Uri.EscapeDataString(TextBoxisbn1.Text)
    ItemId(1) = System.Uri.EscapeDataString(TextBoxisbn2.Text)
    ItemId(2) = System.Uri.EscapeDataString(TextBoxisbn3.Text)
    ItemId(3) = System.Uri.EscapeDataString(TextBoxisbn4.Text)
    ItemId(4) = System.Uri.EscapeDataString(TextBoxisbn5.Text)
    ItemId(5) = System.Uri.EscapeDataString(TextBoxisbn6.Text)
    ItemId(6) = System.Uri.EscapeDataString(TextBoxisbn7.Text)
    ItemId(7) = System.Uri.EscapeDataString(TextBoxisbn8.Text)
    ItemId(8) = System.Uri.EscapeDataString(TextBoxisbn9.Text)
    ItemId(9) = System.Uri.EscapeDataString(TextBoxisbn10.Text)

    ' For Each ItemId As String In ItemIds()


    Dim i As Integer = 0
    System.Threading.Tasks.Parallel.ForEach(ItemIds, Sub(ItemIds)


                                                         My.Settings.ItemId = ItemIds

                                                         Dim MyREST As New SprightlySoftAWS.REST

                                                         Dim RequestURL(i) As String

                                                         RequestURL(i) = "https://webservices.amazon.com/onca/xml?Service=AWSECommerceService&Operation=ItemLookup&Version=2011-08-01"
                                                         'RequestURL(i) = "http://isbndb.com/api/books.xml?Service=AWSECommerceService&Operation=ItemLookup&Version=2011-08-01"

                                                         RequestURL(i) += "&AWSAccessKeyId=AKIAJCA3UI55HFYAXQ6Q&SignatureVersion=2&SignatureMethod=HmacSHA256&Timestamp=" & Uri.EscapeDataString(DateTime.UtcNow.ToString("yyyy-MM-dd\THH:mm:ss.fff\Z"))
                                                         RequestURL(i) += "&AssociateTag=AKIAJCA3UI55HFYAXQ6Q"
                                                         RequestURL(i) += "&ResponseGroup=" & System.Uri.EscapeDataString("ItemAttributes,Large,OfferSummary,Offers,VariationSummary,VariationImages, Reviews")
                                                         RequestURL(i) += "&ItemId=" & System.Uri.EscapeDataString(ItemIds)
                                                         RequestURL(i) += "&IdType=ISBN"
                                                         RequestURL(i) += "&SearchIndex=Books"

                                                         Dim RequestMethod As String
                                                         RequestMethod = "GET"

                                                         Dim SignatureValue As String
                                                         SignatureValue = MyREST.GetSignatureVersion2Value(RequestURL(i), RequestMethod, "", "8igixqKPKWTcsWxgWdqz+rVofSWIPcC3WynhEl1r")

                                                         RequestURL(i) += "&Signature=" & System.Uri.EscapeDataString(SignatureValue)

                                                         Dim RetBool As Boolean
                                                         RetBool = MyREST.MakeRequest(RequestURL(i), RequestMethod, Nothing)

                                                         Debug.Print("")
                                                         Debug.Print(MyREST.LogData)
                                                         Debug.Print("")

                                                         Dim Y As Integer
                                                         Dim ResponseMessage As String = ""
                                                         ResponseMessage = ResponseMessage.Replace(Environment.NewLine, "")


                                                         'Dim strb As String = ResponseMessage.TrimEnd

                                                         If RetBool = True Then
                                                             Dim MyXmlDocument As System.Xml.XmlDocument
                                                             Dim MyXmlNamespaceManager As System.Xml.XmlNamespaceManager
                                                             Dim MyXmlNode As System.Xml.XmlNode
                                                             Dim MyXmlNodeList As System.Xml.XmlNodeList

                                                             MyXmlDocument = New System.Xml.XmlDocument
                                                             MyXmlDocument.LoadXml(MyREST.ResponseString)

                                                             MyXmlNamespaceManager = New System.Xml.XmlNamespaceManager(MyXmlDocument.NameTable)
                                                             MyXmlNamespaceManager.AddNamespace("amz", "http://webservices.amazon.com/AWSECommerceService/2011-08-01")

                                                             MyXmlNodeList = MyXmlDocument.SelectNodes("amz:ItemLookupResponse/amz:Items/amz:Item", MyXmlNamespaceManager)

                                                             If MyXmlNodeList.Count = 0 Then
                                                                 ResponseMessage = "Item not found."
                                                             Else

                                                                 For Each ItemXmlNode As System.Xml.XmlNode In MyXmlNodeList


                                                                     MyXmlNode = ItemXmlNode.SelectSingleNode("amz:ASIN", MyXmlNamespaceManager)
                                                                     ResponseMessage += "Details of " & MyXmlNode.InnerText
                                                                     ResponseMessage += vbCrLf


                                                                     MyXmlNode = ItemXmlNode.SelectSingleNode("amz:ItemAttributes/amz:ISBN", MyXmlNamespaceManager)
                                                                     ResponseMessage += "ISBN" & MyXmlNode.InnerText
                                                                     ResponseMessage += vbCrLf

                                                                     ' MyXmlNode = ItemXmlNode.SelectSingleNode("amz:ASIN", MyXmlNamespaceManager)
                                                                     'ResponseMessage+=Condition "New" 



                                                                     MyXmlNode = ItemXmlNode.SelectSingleNode("amz:ItemAttributes/amz:Title", MyXmlNamespaceManager)
                                                                     ResponseMessage += "Title = " & MyXmlNode.InnerText.Replace(vbCrLf, "")

                                                                     'ResponseMessage = ResponseMessage.Replace(Environment.NewLine, "")

                                                                     ' ResponseMessage += vbCrLf

                                                                     MyXmlNode = ItemXmlNode.SelectSingleNode("amz:MediumImage/amz:URL", MyXmlNamespaceManager)
                                                                     ResponseMessage += "Image = " & MyXmlNode.InnerText

                                                                     'ResponseMessage += Replace(ResponseMessage, vbCrLf, "")

                                                                     'ResponseMessage += vbCr
                                                                     ResponseMessage += vbCrLf


                                                                     MyXmlNodeList = ItemXmlNode.SelectNodes("amz:ItemAttributes/amz:Author", MyXmlNamespaceManager)
                                                                     If IsNothing(MyXmlNodeList) = False Then
                                                                         ResponseMessage += "Author = "
                                                                         For Each MyXmlNode In MyXmlNodeList
                                                                             ResponseMessage += MyXmlNode.InnerText & ", "
                                                                         Next
                                                                     End If

                                                                     ResponseMessage += vbCrLf

                                                                     MyXmlNode = ItemXmlNode.SelectSingleNode("amz:ItemAttributes/amz:ListPrice/amz:FormattedPrice", MyXmlNamespaceManager)
                                                                     ResponseMessage += "ListPrice = "
                                                                     If IsNothing(MyXmlNode) = False Then
                                                                         ResponseMessage += MyXmlNode.InnerText
                                                                     End If

                                                                     ResponseMessage += vbCrLf

                                                                     MyXmlNode = ItemXmlNode.SelectSingleNode("amz:Offers/amz:Offer/amz:OfferAttributes/amz:Condition", MyXmlNamespaceManager)
                                                                     ResponseMessage += "Condition = " & MyXmlNode.InnerText

                                                                     'ResponseMessage += "Condition= New "  

                                                                     ' MessageBox.Show("Condition=new")

                                                                     'MessageBox("Condition=New")

                                                                     'MsgBoxResult("condition=New")

                                                                     ResponseMessage += vbCrLf

                                                                     MyXmlNode = ItemXmlNode.SelectSingleNode("amz:Offers/amz:TotalOffers", MyXmlNamespaceManager)
                                                                     ResponseMessage += "TotalOffers = " & MyXmlNode.InnerText

                                                                     ResponseMessage += vbCrLf

                                                                     MyXmlNode = ItemXmlNode.SelectSingleNode("amz:OfferSummary/amz:TotalNew", MyXmlNamespaceManager)
                                                                     ResponseMessage += "TotalNew = " & MyXmlNode.InnerText

                                                                     ResponseMessage += vbCrLf

                                                                     MyXmlNodeList = ItemXmlNode.SelectNodes("amz:OfferSummary/amz:LowestNewPrice/amz:FormattedPrice", MyXmlNamespaceManager)
                                                                     ResponseMessage += "LowestNewPrice = "
                                                                     Y = 0
                                                                     For Each MyXmlNode In MyXmlNodeList
                                                                         If Y < 25 Then
                                                                             ResponseMessage += "" & MyXmlNode.InnerText & "  "
                                                                         End If
                                                                     Next

                                                                     ResponseMessage += vbCrLf

                                                                     MyXmlNode = ItemXmlNode.SelectSingleNode("amz:OfferSummary/amz:TotalUsed", MyXmlNamespaceManager)
                                                                     ResponseMessage += "TotalUsed = " & MyXmlNode.InnerText

                                                                     ResponseMessage += vbCrLf

                                                                     MyXmlNode = ItemXmlNode.SelectSingleNode("amz:OfferSummary/amz:LowestUsedPrice/amz:FormattedPrice", MyXmlNamespaceManager)
                                                                     ResponseMessage += "LowestUsedPrice = "
                                                                     If IsNothing(MyXmlNode) = False Then
                                                                         ResponseMessage += "" & MyXmlNode.InnerText
                                                                     Else
                                                                         ResponseMessage += "0"
                                                                     End If

                                                                     ResponseMessage += vbCrLf

                                                                     'MyXmlNode = ItemXmlNode.SelectSingleNode("amz:SalesRank", MyXmlNamespaceManager)
                                                                     'ResponseMessage += "SalesRank = " & MyXmlNode.InnerText

                                                                     'ResponseMessage += vbCrLf
                                                                 Next
                                                             End If

                                                             DialogOutput.Text = "Success"
                                                             DialogOutput.TextBoxOutput.Text += vbCrLf & ResponseMessage & vbCrLf
                                                             'DialogOutput.TextBoxOutput.Text += vbCrLf & ResponseMessage


                                                         Else
                                                             ResponseMessage = FormatLogData(MyREST.RequestURL, MyREST.RequestMethod, MyREST.RequestHeaders, MyREST.ResponseStatusCode, MyREST.ResponseStatusDescription, MyREST.ResponseHeaders, MyREST.ResponseStringFormatted, MyREST.ErrorNumber, MyREST.ErrorDescription)

                                                             DialogOutput.Text = "Error"
                                                             DialogOutput.TextBoxOutput.Text = ResponseMessage
                                                             DialogOutput.ShowDialog(Me)
                                                             DialogOutput.Dispose()
                                                         End If

                                                         i = i + 1
                                                     End Sub)
    'Next

    DialogOutput.ShowDialog(Me)
    ClearTextBox(Me)
    sender.Enabled = True
End Sub

当我运行这些代码时..我得到“没有可用的源”错误。请任何人检查代码并给出解决方案。

【问题讨论】:

请进一步描述您的问题。目前尚不清楚您到底在描述什么。也许如果您给出了解决错误所遵循的步骤,那会有所帮助。禁止浏览源是什么意思? 我在 .NET 开发服务器关闭时得到这个。重新运行应用程序通常会重新启动开发服务器并解决问题。 请检查上面的代码.. 【参考方案1】:

在首次运行解决方案之前重新构建它。这曾经经常发生在我身上。

【讨论】:

我试图重建解决方案..但我又得到了同样的错误“没有可用的源”..

以上是关于没有可用的来源..浏览以查找来源的主要内容,如果未能解决你的问题,请参考以下文章

UWP 应用程序在 Windows 10 中的查找结果的图标/磁贴的来源是啥?

从浏览器的 img 请求中获取来源

HTTP 引荐来源网址 - AWS、Sharepoint 和浏览器

来自浏览器的Google Speech API

是否可以在线浏览OpenJDK的来源?

js 区分浏览器来源是PC端还是移动端