admin管理员组文章数量:1287882
I am trying to use the azure sdk to get all the instances for a webapp running in azure. I can see in azure portal that there are 2 instances. When I run my code, it seems to get the site instance collection ok, but when the collection is enumerated, I am getting a 500 internal server error every time from azure. Does anyone have any advice on how to retrieve the list of instances for a WebSiteResource in azure?
Versions of azure sdk:
"Azure.Identity" Version="1.13.2" "Azure.ResourceManager" Version="1.13.0" "Azure.ResourceManager.AppService" Version="1.3.0"
Message: Service request failed.
Status: 500 (Internal Server Error)
Content:
{"Message":"An error has occurred."}
Headers:
Cache-Control: no-cache
Pragma: no-cache
ETag: "1DB7EAE58A85E00"
Strict-Transport-Security: REDACTED
X-AspNet-Version: REDACTED
X-Powered-By: REDACTED
x-ms-failure-cause: REDACTED
x-ms-ratelimit-remaining-subscription-reads: REDACTED
x-ms-ratelimit-remaining-subscription-global-reads: REDACTED
x-ms-request-id: 43e3b7fa-d117-4ef6-998e-69258d2c2233
x-ms-correlation-request-id: REDACTED
x-ms-routing-request-id: REDACTED
X-Content-Type-Options: REDACTED
X-Cache: REDACTED
X-MSEdge-Ref: REDACTED
Date: Fri, 21 Feb 2025 19:18:41 GMT
Content-Length: 36
Content-Type: application/json; charset=utf-8
Expires: -1
ErrorCode:
Status: 500
Stacktrace:
at Azure.Core.PageableHelpers.PageableImplementation`1.GetResponse(HttpMessage message)
at Azure.Core.PageableHelpers.PageableImplementation`1.GetNextResponseAsync(Nullable`1 pageSizeHint, String nextLink, CancellationToken cancellationToken)
at Azure.Core.PageableHelpers.PageableImplementation`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
at Azure.Core.PageableHelpers.PageableImplementation`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at UserQuery.GetSiteInstances(ArmClient armClient, String resourceGroupName, String webSiteName), line 33
at UserQuery.GetSiteInstances(ArmClient armClient, String resourceGroupName, String webSiteName), line 33
at UserQuery.Main(), line 4
I am trying this:
public async Task<IEnumerable<SiteInstanceResource>> GetSiteInstances(ArmClient armClient, string resourceGroupName, string webSiteName)
{
var subscription = await armClient.GetDefaultSubscriptionAsync();
var resId = WebSiteResource.CreateResourceIdentifier(subscription.Data.SubscriptionId, resourceGroupName, webSiteName);
var webSite = armClient.GetWebSiteResource(resId);
await webSite.GetAsync();
var siteInstances = new List<SiteInstanceResource>();
var allSiteInst = webSite.GetSiteInstances();
var allSites = allSiteInst.GetAllAsync();
await foreach (var instance in allSites)
{
siteInstances.Add(instance);
}
return siteInstances;
}
I am expecting to get 2 SiteInstanceResource's that I can add to a List to pass back to the code that called this method. The code will have the ability to stop or restart a specific instance. Instead, when I await foreach on that collection, I am getting a 500 internal server error.
本文标签: debuggingAzure Net SDK WebSiteResourceGetSiteInstances() throwing 500 every timeStack Overflow
版权声明:本文标题:debugging - Azure .Net SDK WebSiteResource.GetSiteInstances() throwing 500 every time - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741324577a2372402.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论