当我尝试运行我接手的项目时,我收到此错误.
我假设我的web.config有问题,但我不知道该找什么.
类型'System.Web.Mvc.MvcWebRazorHostFactory'的表达式不能用于返回类型'System.Web.WebPages.Razor.WebRazorHostFactory'
对此相关的任何建议都非常感谢.
我试图获取由Microsoft Graph API收件人筛选的邮件列表.我用于请求的网址是:
https://graph.microsoft.com/beta/me/messages?$filter=toRecipients/any(r: r/emailAddress/address eq '[Email Address]')
但我得到的是这个回应:
{
"error": {
"code": "ErrorInvalidUrlQueryFilter",
"message": "The query filter contains one or more invalid nodes.",
"innerError": {
"request-id": "7db712c3-e337-49d9-aa8d-4a5d350d8480",
"date": "2016-09-28T16:58:34"
}
}
}
Run Code Online (Sandbox Code Playgroud)
一个成功的请求应该是这样的(我已经省略了更多的数据).
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#users('99999999-9999-9999-9999-999999999999')/messages",
"@odata.nextLink": "https://graph.microsoft.com/beta/me/messages?$skip=10",
"value": [
{
"toRecipients": [
{
"emailAddress": {
"name": "[Name]",
"address": "[Email Address]"
}
}
],
}
]
}
Run Code Online (Sandbox Code Playgroud)
如果我删除过滤器,请求有效,并且我能够使用更简单的过滤器执行请求.
我的网址有问题,还是有另外一种方式来提出请求?
我有一些存储在字符串中的HTML.如何渲染这是没有自动HTML编码的Blazor/Razor视图?
我正在尝试使用该命令将我的提交推送到Bitbucket
git push origin master
Run Code Online (Sandbox Code Playgroud)
什么都没发生.我用命令提示符表示,没有错误消息.当我在线浏览源代码时,我的代码尚未上传.
git remote show
Run Code Online (Sandbox Code Playgroud)
返回"原点"
git push --verbose
Run Code Online (Sandbox Code Playgroud)
不显示任何其他信息.
我已经多次使用这种方法,但它突然停止工作.
我2.6.1.windows.1
在Windows 10上使用
更新:Git本身似乎存在问题.我不能在GitHub或Bitbucket上推送,拉动或克隆任何存储库.似乎连接到远程的任何git命令都不起作用.
我尝试卸载并重新安装git.我尝试安装2.6.1和2.7.0(2.7甚至没有在Windows 10 Build 14251上正确安装).我可以在没有其他计算机问题的情况下与回购交互.
我正在创建一个机器人,允许用户与现有的Web服务进行交互.我希望用户能够与我的机器人开始对话并检索对他们个性化的信息.
如何将僵尸程序用户与其现有帐户相匹配?并非所有频道都使用电子邮件地址,因此我不能将其用于匹配.
我想在聊天窗口中添加一个链接,上面写着"你需要在继续之前注册僵尸框架",并提供一个链接回我的服务,其中包含他们的Bot Framework全局UserId.然后,我可以将此Id存储在我现有服务的数据库中,并使用它来验证用户身份.
有一个更好的方法吗?机器人应该被视为独立应用程序吗?
我有一个Xamarin Android项目,我正在尝试添加对我自己的netstandard1.4类库的引用.当我添加引用时,我的Android应用程序将不再构建.我明白了error MSB4057: The target "GetBuiltProjectOutputRecursive" does not exist in the project.
如果我删除引用,我的android项目构建正常.
类库是我刚刚创建的一个全新的库.它还不包含任何实际代码.
我正在使用Visual Studio 2017.
更新:如果我使用"浏览"功能添加对我的DLL的引用,它的工作原理.在我的解决方案中添加对项目的引用时,我只收到错误.
我曾经使用数据库图创建所有表关系,但在安装VS2013之后,该功能似乎缺失了.是完全删除了,还是可以重新打开?
sql-server entity-framework visual-studio visual-studio-2013
如果我创建一个新的 Blazor WASM 应用程序,我可以通过dotnet watch run
在终端窗口中运行来开箱即用地使用热重载。这将启动一个浏览器窗口,我所做的任何更改都会在浏览器中自动更新。
但是,如果我在 Visual Studio 中启动带有附加调试器 (F5) 的应用程序,则不会获得任何热重载功能。当我进行更改时,Visual Studio 在左下角显示一条消息,显示Code Changes were applied successfully
,但浏览器不会刷新。如果我手动刷新浏览器,我仍然看不到我的更改。
我选中了“保存时热重载”。按新的热重载按钮似乎没有任何作用。
浏览器刷新脚本被注入到我的 html 中。<script src="/_framework/aspnetcore-browser-refresh.js"></script>
我正在使用 Visual Studio 2022 版本 17.0.0 预览版 7.0 和 dotnet 6 RC 2 (6.0.0-rc.2.21480.10)。
在调试 Blazor WASM 应用程序时是否无法使用热重载,或者我是否遗漏了某些内容?
该模型
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class GetPeopleResult
{
public List<Person> people { get; set; }
public GetPeopleResult()
{
this.people = new List<People>();
}
public static GetPeopleResult CreateFromJSON(string jsonString)
{
return JsonUtility.FromJson<GetPeopleResult>(jsonString);
}
}
[System.Serializable]
public class Person
{
public long id { get; set; }
public string name { get; set; }
public string email { get; set; }
public string displayImageUrl { get; set; }
public Person()
{
}
public static Person CreateFromJSON(string jsonString)
{
return JsonUtility.FromJson<Person>(jsonString); …
Run Code Online (Sandbox Code Playgroud) 我有一个 Blazor WASM 页面,需要进行调用以从 API 获取一些数据。Blazor 应用程序由 ASPNetCore 托管,并且托管应用程序包含 API。
我的一些端点可以工作,但一些调用会引发 Json 序列化异常。
渲染组件未处理的异常:“<”是值的无效开头。路径: $ | 行号: 0 | 内联字节位置:0。
如果我查看服务器的实际响应,它看起来像是从我的 WASM 应用程序返回 index.html 的内容。
控制器示例
[Authorize]
[ApiController]
[Route("api/[controller]")]
public class CompanyController : ControllerBase
{
private readonly ApplicationDbContext _context;
public CompanyController(ApplicationDbContext context)
{
_context = context;
}
[HttpGet("{id}")]
public async Task<IActionResult> Get(long id)
{
Company? company = await _context.Companies.FindAsync(id);
if (company == null)
{
return NotFound();
}
return Ok(company);
}
}
Run Code Online (Sandbox Code Playgroud)
Blazor 页面示例
@page "/companies/{id:long}"
@attribute [Authorize]
@inject HttpClient Http …
Run Code Online (Sandbox Code Playgroud) 我有一个WebView,我用它来从ApplicationData.Current.LocalFolder加载本地文件.我做了一个在WebView上调用Navigate的方法
public override void BrowserNavigateLocal(string fileName)
{
Uri uri = browser.BuildLocalStreamUri("page", fileName);
browser.NavigateToLocalStreamUri(uri, new MyStreamUriResolver());
}
Run Code Online (Sandbox Code Playgroud)
我的IUriToStreamResolver看起来像这样
public sealed class MyStreamUriResolver : IUriToStreamResolver
{
public IAsyncOperation<IInputStream> UriToStreamAsync(Uri uri)
{
lock (this)
{
if (uri == null)
{
throw new Exception();
}
string path = uri.AbsolutePath;
return GetContent(path).AsAsyncOperation();
}
}
private async Task<IInputStream> GetContent(string path)
{
try
{
Uri localUri = new Uri("ms-appdata:///local/HTML" + path);
//StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(localUri);
//IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read);
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(localUri).AsTask().ConfigureAwait(false);
IRandomAccessStream …
Run Code Online (Sandbox Code Playgroud) 我正在尝试为主菜单中的按钮制作一个组件。
<NavLink href="@Href" title="@Title">
<div class="main-menu-button">
<img src="@IconUrl" />
<div class="label">
@Label
</div>
</div>
</NavLink>
@code {
[Parameter]
[EditorRequired]
public string? Href { get; set; }
[Parameter]
[EditorRequired]
public string? Label { get; set; }
[Parameter]
public string? Title { get; set; }
[Parameter]
[EditorRequired]
public string? IconUrl { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我似乎无法在 css 文件中定位 NavLink。我已经尝试了所有这些不同的变体,但按钮在激活时永远不会改变颜色。
::deep a.active {
background-color: red !important;
}
::deep .active {
background-color: green !important;
}
::deep a .active {
background-color: blue !important;
}
a.active …
Run Code Online (Sandbox Code Playgroud) blazor ×4
c# ×2
asp.net-core ×1
asp.net-mvc ×1
bitbucket ×1
botframework ×1
git ×1
hot-reload ×1
json ×1
odata ×1
razor ×1
sql-server ×1
unity5 ×1
windows-8.1 ×1
xamarin ×1
xaml ×1