我在 .NET 6 中有一个小项目,其中包含类似的最少 API
app.MapGet("/clients",
async (IClientRepository repo) =>
{
var results = await repo.GetClientsAsync();
return mapper.Map<IEnumerable<ClientModel>>(results);
});
Run Code Online (Sandbox Code Playgroud)
在SwaggerUI我可以使用这个 API,但我找不到向其添加描述的方法(尽管在项目设置中我检查了创建 API XML 文档)。
如何添加 XML 注释?
我正在创建一个新的 ASP.NET Core 8 Web API。在我之前使用 .NET 6 或 .NET 7 的项目中,我可以使用:
services.AddApiVersioning(options =>
{
options.DefaultApiVersion = new ApiVersion(1, 0);
options.AssumeDefaultVersionWhenUnspecified = true;
options.ReportApiVersions = true;
});
services.AddVersionedApiExplorer(options =>
{
options.GroupNameFormat = "'v'VVV";
options.SubstituteApiVersionInUrl = true;
});
Run Code Online (Sandbox Code Playgroud)
现在,该软件包Microsoft.AspNetCore.Mvc.ApiExplorer已被弃用,我将其替换为新软件包Asp.Versioning.Mvc.ApiExplorer,但没有AddVersionedApiExplorer.
在 Swagger 的配置中,我有以下代码:
public class ConfigureSwaggerOptions : IConfigureNamedOptions<SwaggerGenOptions>
{
private readonly IApiVersionDescriptionProvider _provider;
public ConfigureSwaggerOptions(IApiVersionDescriptionProvider provider)
{
_provider = provider;
}
public void Configure(SwaggerGenOptions options)
{
foreach (var description in _provider.ApiVersionDescriptions)
{
options.SwaggerDoc(
description.GroupName,
CreateVersionInfo(description));
} …Run Code Online (Sandbox Code Playgroud) 我已经创建了 Azure API 管理服务并连接了我的 API。我CORS给它们添加了策略。
我检查了计算有效策略,结果是这个策略
<policies>
<inbound>
<!-- base: Begin Product scope -->
<!-- base: Begin Global scope -->
<cors allow-credentials="true">
<allowed-origins>
<origin>https://developer.mydomain.com</origin>
</allowed-origins>
<allowed-methods preflight-result-max-age="300">
<method>*</method>
</allowed-methods>
<allowed-headers>
<header>*</header>
</allowed-headers>
<expose-headers>
<header>*</header>
</expose-headers>
</cors>
<!-- base: End Global scope -->
<!-- base: End Product scope -->
<cors>
<allowed-origins>
<origin>*</origin>
</allowed-origins>
<allowed-methods>
<method>GET</method>
<method>POST</method>
</allowed-methods>
</cors>
</inbound>
<backend>
<!-- base: Begin Product scope -->
<!-- base: Begin Global scope -->
<forward-request />
<!-- base: End …Run Code Online (Sandbox Code Playgroud) 我应该从我的设备中获得符号.我按照http://jmillerdev.net/symbolicating-ios-crash-files-xamarin-ios的说明进行操作.
我创建了aliasfor Xcode 8
别名symbolicate ="/ Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash -v"
我更新了开发人员目录
export DEVELOPER_DIR ="/ Applications/Xcode.app/Contents/Developer"
然后是符号
symbolicate -o"symbolicatedCrash.txt""MyAppName 2-12-14,9-44 PM.crash""MyAppName.app"
但我有一个错误
象征myInventories170313.crash ...在阅读myInventories170313.crash时,没有这样的文件或目录:at /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash line 899.
我想要实现的是一个 POC,其中两个用户使用 ASP.NET Core 和 WebRTC(如果需要 SignalR)在对等视频通话中聊天。
我阅读了很多关于 WebRTC的文档,但我发现的大多数示例都不起作用,因为它们显示了该协议的旧实现(例如本教程)。另外,我在Github上看到了这个实现,但它使用getUserMedia. 如果我使用最新版本的adapter.js.
我用谷歌搜索了一下,我发现了其他例子,比如一篇关于html5rocks 的文章:在这种情况下,indx.html在本地工作,但如果我将它部署在服务器上,我会收到这个错误。
我尝试使用的最后一个脚本是Simple Peer。
如果我理解正确,新的正确方法是使用RTCPeerConnectionand RTCDataChannel。我找不到工作示例。
在 Blazor 中,我想将maxlength属性添加到input类似的
<textarea type="text" name="TheNameOfMyField"
class="TheNameOfMyClass" value="" rows="2" maxlength="255">
</textarea>
Run Code Online (Sandbox Code Playgroud)
Blazor 中的组件是这样的
<InputTextArea @bind-Value="_model.ShortDescription"
class="form-control" id="gapShortDescription" />
Run Code Online (Sandbox Code Playgroud)
并且没有 maxlength 或自定义 HTML 属性的选项。
我怎样才能做到这一点?
今天我将 Visual Studio 更新到 17.4.0 Preview 2.1。
Microsoft Visual Studio Community 2022(64 位)- 预览版 17.4.0 预览版 2.1
之后,我无法部署 Blazor 应用程序,因为出现以下错误:
要构建此项目,必须安装以下工作负载:wasm-tools-net6 要安装这些工作负载,请运行以下命令:dotnet工作负载恢复
我运行了命令但没有任何改变。
我该如何修复它?
我看到了有关 Azure Functions 版本 3 的Azure 服务总线输出绑定的 Microsoft 文档。当我想将消息发送到服务总线作为函数的返回时,我可以使用以下代码:
[FunctionName("ServiceBusOutput")]
[return: ServiceBus("myqueue", Connection = "ServiceBusConnection")]
public static string ServiceBusOutput([HttpTrigger] dynamic input, ILogger log)
{
log.LogInformation($"C# function processed: {input.Text}");
return input.Text;
}
Run Code Online (Sandbox Code Playgroud)
当我想将 2 条消息作为输出发送到不同的服务总线时,我的问题就开始了。是否可以输出绑定多个输出?在在线编辑器中,您可以添加多个输出。我怎样才能在代码中做到这一点?
在文档中有一个用法部分,它解释了我可以使用什么作为输出绑定。他们提到ICollector<T>或IAsyncCollector<T>但我不确定这就是我要找的。
另一个问题是,如果 API 将一个值返回给总线,将另一个值返回给用户,会发生什么情况?
在我的Xamarin解决方案中,我在Controls解决方案文件夹中添加了一个新的库项目.从我XAML在Views我打电话给我的分量和一切工作正常.
我不知道在更新之后今天是否有什么变化iOS 10,Visual Studio for Mac但是如果我尝试编译我的解决方案,我不会收到错误
System.Reflection.TargetInvocationException:调用目标抛出了异常.---> Xamarin.Forms.Xaml.XamlParseException:位置43:38.在xmlns clr-namespace中找不到类型Donut:Mobile.Controls.Wheel; assembly = Mobile.Controls.Wheel
at Xamarin.Forms.Xaml.Internals.XamlTypeResolver.Xamarin.Forms.Xaml.IXamlTypeResolver.Resolve(System.String qualifiedTypeName,System .IServiceProvider serviceProvider)
该XAML页面是这样定义的:
<ContentPage [...]
xmlns:ctl="clr-namespace:Mobile.Controls.Wheel;assembly=Mobile.Controls.Wheel"
x:Class="Views.DashboardPage">
<StackLayout>
<ctl:Doughnut HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" />
</StackLayout>
</ContentPage>
Run Code Online (Sandbox Code Playgroud)
Doughnut是衍生自类ContentView在Mobile.Controls.Wheel.
在上一个问题中,我问了一个通用问题如何添加静态内容的权限。在这里我想说得更准确一些。
\n在我的项目中,我添加了一个文件夹wwwroot来简化代码,我在其中保存要保护的 html 文件。该文件夹称为infographics。
每个文件的属性是:
\n按照Microsoft文档的说明,我更改了Startup.cs
\npublic class Startup\n{\n public Startup(IConfiguration configuration)\n {\n Configuration = configuration;\n }\n\n public IConfiguration Configuration { get; }\n\n // This method gets called by the runtime. Use this method to add services to the container.\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddControllersWithViews();\n services.Configure<IdentityServerConfiguration>(Configuration.GetSection("IdentityServerConfiguration"));\n\n services.AddDistributedMemoryCache();\n\n services.AddSession(options =>\n {\n options.Cookie.Name = ".my.Session";\n options.IdleTimeout = TimeSpan.FromHours(12);\n });\n\n services.AddAuthentication(options =>\n …Run Code Online (Sandbox Code Playgroud) c# ×4
asp.net-core ×3
.net-6.0 ×1
.net-8.0 ×1
azure ×1
blazor ×1
cors ×1
ios ×1
minimal-apis ×1
signalr ×1
swagger ×1
swagger-ui ×1
webrtc ×1