admin管理员组文章数量:1386701
I try to connect openwebui to aspire through docker container using this code like in microsoft docomentation
var openwebui = builder.AddContainer("openwebui", "ghcr.io/open-webui/open-webui", "latest")
.WithHttpEndpoint(3000, 3000, name: "openwebui");
var opnweb = openwebui.GetEndpoint("openwebui");
builder.AddProject<Projects.BlazorApp>("frontend")
.WithReference(opnweb);
In blazor app try to send request to openwebui
@page "/counter"
@rendermode InteractiveServer
@inject IHttpClientFactory HttpClientFactory
<PageTitle>Counter</PageTitle>
<h1>Counter</h1>
<p role="status">Current count: @models</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private string models = "";
private async Task IncrementCount()
{
using var http = HttpClientFactory.CreateClient();
var response = await http.GetAsync("http://openwebui:3000/api/models");
models = await response.Content.ReadAsStringAsync();
}
}
How to connect apps throgh docker container and use it in my application
本文标签: cConnect Docker container to aspire applicationStack Overflow
版权声明:本文标题:c# - Connect Docker container to aspire application - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744534869a2611250.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论