我是最近转换为C#的VB开发人员,但到目前为止还有一件事我无法找到.在VB中,当我设置一个新项目时,我可以指定项目中使用的命名空间,并将它们添加到所有类的默认导入中(因此所有内容都自动拥有它们,就好像我为每个类添加了"Imports System.Data.OracleClient").使用C#我发现我总是为每个新类输入这些内容.有没有办法为项目设置默认值,所以它至少会自动将它们附加到每个类文件中?
我们有一个生产网站,混合了经典的ASP,内联.Net和编译的.Net,它与一个SQL Server实例对话,其中两个虚拟机都在同一个物理盒上,而且一切都很好.为了使用新功能进行一些测试,我创建了站点的QA版本,并将其设置为连接到托管在另一台物理服务器上的VM上的数据库.它们是不同的网络(DMZ /内部),但都在千兆位的同一机架中,因此连接速度不应成为问题.
我们遇到的问题是QA版本会工作一段时间然后突然死亡,直到我重新启动应用程序池和站点.这不是一个负载问题,因为它只是我和另外两个人测试这个过程而且我已经确认QA数据库所在的服务器没有资源问题(16GB RAM,3.2GB使用和处理器利用率悬停在2%范围).所有页面变体都会出现特定错误(如下所示) - 经典ASP,内联.Net和已编译的.Net页面.根据我所做的所有研究,我不断指出它是防火墙问题,但我们甚至打开了两台服务器之间的所有端口,但它仍然会发生.最奇怪的部分是当我们在我们的ASA(5515-X)上启用跟踪时,它几乎看不到任何流量,有时网站会立即恢复该错误,而其他时间需要30秒以上.有问题的页面没有进行任何强烈的查找(一个页面已经消失,总共抓取了大约60条记录).这是完整的错误/堆栈跟踪:
[Win32Exception (0x80004005): The wait operation timed out]
[SqlException (0x80131904): Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=21008; handshake=12; ]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +6749670
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +815
System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject …Run Code Online (Sandbox Code Playgroud) 我试图弄清楚如何让文本框包装其内容,但情况与典型的"它不包装"场景并不完全相同.我的文本框包含在一个DataTemplate中,该DataTemplate在Telerik RadTabControl实例中使用(使用ContentTemplatePresenter来确定要显示的视图),DataTemplate的XAML如下所示:
<DataTemplate x:Key="NotesTemplate">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="Use the box below to record any general notes associated with this item." Style="{StaticResource Default}" />
<TextBox TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" GridRow="1" Margin="20" Text="{Binding Notes, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)
我之所以说它不属于正常的"它没有换行"的情况是它用来换行,直到我不得不将视图更改为可调整大小以支持应用程序将运行的不同屏幕大小.当我这样做时,TextBox停止换行,因为(大概)当用户输入TextBox说"我需要更多空间"的东西时,父母必须这样,并且盒子无限期地向右延伸(尽管视图获得滚动条).我尝试使用Binding/RelativeSource设置MaxWidth,但由于父设计专门用于增长,因此该方法不起作用.我需要做的是盒子应该是'包含父母' VisibleWidth的宽度.意思是,如果Window本身是1024x768,TextBox的MaxWidth应该是1024,之后的任何文本都会自动换行,但是如果Window增长到1280x1024,则该框现在应该是1280并且文本换行相应.我用这个绑定表达式尝试了这个场景,但没有运气:
MaxWidth="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}, Path=ActualWidth}"
Run Code Online (Sandbox Code Playgroud)
窗口大小本身没有增长,所以如果我可以得到窗口的宽度(减去一定量以覆盖TabControl的一部分的选项卡的宽度)我相信这将工作.
有任何想法吗?
我最初在MVVM Light CodePlex页面上发布此消息但尚未听到响应,所以我希望有人可以帮助我.这是一个问题:
我最近开始玩MVVM(WPF的新手 - 相当于所有这些的学习曲线),在我开始使用CodePlex上提供的MetroToolkit之前,我的ViewModelLocator实例和VS2010的绑定设计时间一切正常.在使用工具包之前,我有以下内容:
<Application.Resources>
<local:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
我的所有观点都很有意义,一切看起来都非常好.我很惊讶没有MVVM(或MVC)经验的人可以轻松起步和运行.然后我遇到了需要合并资源字典的MetroToolkit,现在无论我尝试什么,我都无法让VS在App.xaml中再次找到我的ViewModelLocator.这是新的标记:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Colors.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Animations.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Geometry.xaml"/>
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Generic.xaml"/>
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Buttons.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Scrollbar.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Scrollviewer.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/RadioButton.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/ProgressBar.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/ContextMenu.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Tooltip.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Checkbox.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Headings.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Textbox.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Combobox.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Slider.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/Expander.xaml" />
<ResourceDictionary Source="/MetroToolkit;component/Themes/Dark/TabControl.xaml" />
</ResourceDictionary.MergedDictionaries>
<local:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
</ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
我已经尝试给资源字典一个密钥,在该区域之外添加该行(上方和下方 - 引发令人讨厌且非常无用的错误)并且无法让它找到我的VM定位器.当我从App.xaml中删除块时,它立即起作用,但基于我对WPF的非常有限的了解,如果我希望样式可用于我的应用程序中的所有视图,我需要这些.
有什么想法吗?这让我疯了几个小时了.
我使用Visual Studio 2017进行Web开发非常重要,当你让它打开浏览器时(Chrome是我的首选,虽然这适用于Edge)它经常加载脚本和CSS的缓存版本.我知道我可以去Network选项卡并选择Disable Cache,但有没有办法让VS只是总是加载浏览器选择该选项?
我正在使用我的第一个 Blazor 应用程序并遇到一个奇怪的问题。我有一个 Web API,它返回一个相当基本的 JSON 响应:
{
"entityId": 26,
"notifications": [
{
"type": "Success",
"message": "The operation completed successfully."
}
],
"hasErrors": false,
"hasWarnings": false
}
Run Code Online (Sandbox Code Playgroud)
有一个标准的 POCO 类与上述属性相匹配。从 Blazor 应用程序中,当我尝试从 an 获取响应时Http.PutAsJsonAsync<T>,会创建 POCO 类的实例(因此它不为 null 并且不会引发错误),但上述值实际上都不存在。该EntityId属性为 null 并且Notifications已实例化但为空。我尝试访问响应的方式是:
var result = await Http.PutAsJsonAsync<ManufacturerModel>($"manufacturers", (ManufacturerModel)context.Model);
if (result.IsSuccessStatusCode)
{
var response = await JsonSerializer.DeserializeAsync<EntityResponseModel>(result.Content.ReadAsStream());
//response isn't null - it's just a newly created object with nothing mapped
}
Run Code Online (Sandbox Code Playgroud)
通过 Chrome 中的控制台,我已经确认返回了正确的 JSON,所以它真的很令人困惑为什么它会创建该类的新实例,但不映射任何值。
有任何想法吗?
**** …
我正在为我支持的应用程序配置新的测试服务器.它使用大约35个不同的MSMQ队列,并且手动创建这些队列显然不是很有趣.特别是因为应用程序的生产版本也在移动服务器,所以我将重新做到这一点.我正在寻找的是一种创建这些队列的自动化方法,而Powershell(基于我对它的有限了解)似乎是要走的路.
有没有人有关于我如何实现这一目标的任何提示?
我正在尝试开始学习PHP(.Net是我的主要环境),它看起来像是XAMPP.我设置了一个新的Windows 10 VM(Build#10074,这是写作的最新版本),它安装了所有更新.
我安装了XAMPP没有任何问题,Apache/MySQL启动没有任何问题(正常和作为服务)但当我尝试浏览到http:// localhost时,我得到一个无法连接错误.我在几个地方读过,更改端口号可以提供帮助,所以我在配置中更改为88(两个地方),但仍然没有运气.我甚至尝试通过http:// [IP]:88连接,但仍然没有骰子.Skype被卸载(读取会导致问题),IIS从未安装过(所以没有万维网发布服务),一切都说明了,但我无法连接.我甚至完全关闭了Windows防火墙,但仍然没有.
唯一的错误日志条目是它似乎正在启动精细减去SSL配置,我不关心:
[Wed May 20 06:19:42.427262 2015] [mpm_winnt:notice] [pid 1784:tid 596] AH00455: Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8 configured -- resuming normal operations
[Wed May 20 06:19:42.427262 2015] [mpm_winnt:notice] [pid 1784:tid 596] AH00456: Apache Lounge VC11 Server built: Jan 28 2015 16:48:40
[Wed May 20 06:19:42.427262 2015] [core:notice] [pid 1784:tid 596] AH00094: Command line: 'C:\\dev\\xampp\\apache\\bin\\httpd.exe -d C:/dev/xampp/apache'
[Wed May 20 06:19:42.427262 2015] [mpm_winnt:notice] [pid 1784:tid 596] AH00418: Parent: Created child process 2744
[Wed …Run Code Online (Sandbox Code Playgroud) 我正在尝试在WPF中创建类似于下图的内容.这个控件被设计成我应用程序中所有内容的基本视图,并且将位于具有背景的Window控件内(可能是某种渐变).
要求如下:
我已经和我斗争了好几个小时,但是对于WPF来说,我开始发现自己在圈子里跑来跑去.我认为WPF的灵活性有很大的好处,但对于刚开始使用它的人来说几乎是太令人生畏了.
任何帮助将非常感激!谢谢!

我在 Wordpress 站点中利用 ACF 为自定义帖子类型配置一些选项,并使用 ACF 唯一 ID 插件生成一个字段,该字段为该字段构建唯一 ID。它的配置非常基本:
class acf_field_unique_id extends acf_field {
function __construct() {
/*
* name (string) Single word, no spaces. Underscores allowed
*/
$this->name = 'unique_id';
/*
* label (string) Multiple words, can include spaces, visible when selecting a field type
*/
$this->label = __('Unique ID', 'acf-unique_id');
/*
* category (string) basic | content | choice | relational | jquery | layout | CUSTOM GROUP NAME
*/
$this->category = 'layout';
/*
* l10n (array) …Run Code Online (Sandbox Code Playgroud) c# ×4
wpf ×3
apache ×1
asp-classic ×1
asp.net ×1
iis-8 ×1
msmq ×1
mvvm-light ×1
namespaces ×1
php ×1
powershell ×1
sql-server ×1
textbox ×1
windows-10 ×1
word-wrap ×1
wordpress ×1
xaml ×1
xampp ×1