我用.NET 4.0编写了一个WCF服务,它x64使用IIS 7.5 托管在我的Windows 7 Ultimate系统上.其中一个服务方法有一个'对象'作为参数,我正在尝试发送一个包含图片的byte [].只要这张照片的文件大小小于约.48KB,一切顺利.但是,如果我试图上传更大的图片,WCF服务会返回错误:(413) Request Entity Too Large.
所以当然我花了3个小时谷歌搜索错误消息,我看到的关于这个主题的每个主题都建议提高'uploadReadAheadSize'属性.所以我所做的是使用以下命令(10485760 = 10MB):
"appcmd.exe set config -section:system.webserver/serverruntime/uploadreadaheadsize: 10485760 /commit:apphost"
"cscript adsutil.vbs set w3svc/<APP_ID>/uploadreadaheadsize 10485760"
我还使用IIS管理器通过打开站点并转到管理下的"配置编辑器"来设置值.不幸的是,我仍然收到请求实体太大的错误,它真的很令人沮丧!
那么有谁知道我还能尝试修复这个错误吗?
我正在尝试使用Visual Studio 2012,.NET 4来检测ASP.NET Web应用程序.该解决方案包含一个Web应用程序和一个类库.问题是我看不到步骤进入类库,我收到一条消息说明:
Matching symbols could not be found. Choose the 'Symbol Settings...' link to add the symbol file location and then reload the report.
Run Code Online (Sandbox Code Playgroud)
分析时的输出看起来很好:
Preparing web server for profiling.
Profiling started.
Instrumenting C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\\bin\PerformanceTest.dll in place
Info VSP3049: Small functions will be excluded from instrumentation.
Microsoft (R) VSInstr Post-Link Instrumentation 11.0.50727 x86
Copyright (C) Microsoft Corp. All rights reserved.
File to Process:
C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\bin\PerformanceTest.dll --> C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\bin\PerformanceTest.dll
Original file backed up to C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\bin\PerformanceTest.dll.orig
Successfully instrumented file C:\Users\kipusoep\Documents\InfoCaster\svn\instances\PerformanceTest\bin\PerformanceTest.dll.
Warning VSP2013: …Run Code Online (Sandbox Code Playgroud) 我很难通过Webdeploy使用Visual Studio 2012 UI部署我的第三方非参考程序集.我有一个名为'libraries'的文件夹,其中包含一些程序集.通过我的*.csproj文件中的以下内容,我可以将Build Action设置为' ThirdPartyAssemblies ':
<ItemGroup>
<AvailableItemName Include="ThirdPartyAssemblies">
<Visible>false</Visible>
</AvailableItemName>
</ItemGroup>
<Target Name="AfterBuild">
<Message Text="Build | Third party assemblies" Importance="high" />
<Copy DestinationFolder="$(OutputPath)" SourceFiles="@(ThirdPartyAssemblies)" SkipUnchangedFiles="true" />
</Target>
Run Code Online (Sandbox Code Playgroud)
这很好用; 当我构建时,程序集被复制到bin文件夹的根目录:-)现在我遇到了一个问题:我无法通过Webdeploy将这些文件发布到服务器上.我尝试了很多东西,看起来我找不到适合这个任务的MSBuild目标...使用Visual Studio 2010我可以使用:
<Target Name="MyTargetName">
<Message Text="Deploy | Third party assemblies" Importance="high" />
<Copy DestinationFolder="$(OutputPath)" SourceFiles="@(ThirdPartyAssemblies)" SkipUnchangedFiles="true" />
</Target>
<PropertyGroup>
<OnAfterCopyAllFilesToSingleFolderForPackage>
MyTargetName
</OnAfterCopyAllFilesToSingleFolderForPackage>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
问题是; 该OnAfterCopyAllFilesToSingleFolderForPackage目标不再被称为: - /
在深入研究之后C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets' file, I've also tried 'OnAfterCopyAllFilesToSingleFolderForMsdeploy,我却无法让它发挥作用.
任何人都可以告诉我我可以使用哪些目标将这些程序集复制到Package文件夹/带有Webdeploy的服务器?
为什么Visual Studio 2012没有将完整的bin文件夹复制到Package文件夹?
msbuild msbuild-task webdeploy msbuild-target visual-studio-2012
我无法从 Linux 盒子(docker 容器)上运行的 .NET Core 成功调用具有 NTLM 身份验证的 WCF 服务。不过,相同的代码在 Windows 10 上完美运行。
我做了什么:
ConfigureServices:AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
Run Code Online (Sandbox Code Playgroud)
apt-get -y install gss-ntlmsspvar client = new WcfServiceSoapClient();
client.Endpoint.Address = new EndpointAddress(settings.Uri);
client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
client.ClientCredentials.Windows.ClientCredential = new NetworkCredential
{
Domain = settings.Domain,
UserName = settings.Username,
Password = settings.Password
};
var binding = (BasicHttpBinding)client.Endpoint.Binding;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Ntlm;
Run Code Online (Sandbox Code Playgroud)
如前所述,这在 Windows 10 上运行良好。在 Linux 上,会记录以下错误:
System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Ntlm'. …Run Code Online (Sandbox Code Playgroud)