我遇到了这个我正在努力处理的疯狂问题.我知道当我们获取大量数据时,我们必须增加客户端.config文件的配额,但如果我的客户端向WCF服务器发送大量数据,我应该怎么做?
当我发送小尺寸输入参数时,它完全正常.不幸的是,当输入变大时,它会崩溃.
调试器说:
错误请求,400;
在跟踪文件上它是:
已超出传入邮件的最大邮件大小限额(65536).要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性.
是否有某种方法可以增加服务器端的数据配额?如果是这样,怎么样?
这是我的示例配置相关部分:
<bindings>
<basicHttpBinding>
<binding name="MyBasicHttpBinding"
closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00"
sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="MyWcfService">
<endpoint address="http://myservice..."
binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBinding"
name="MyBasicHttpBinding" contract="IMyContract" />
</service>
</services>
Run Code Online (Sandbox Code Playgroud)
这是我的客户端代码(我动态创建):
var binding = new BasicHttpBinding();
binding.MaxBufferPoolSize = 2147483647;
binding.MaxBufferSize = 2147483647;
binding.MaxReceivedMessageSize = 2147483647;
binding.ReaderQuotas.MaxStringContentLength = 2147483647;
binding.ReaderQuotas.MaxArrayLength = …Run Code Online (Sandbox Code Playgroud) 当我经常向用户列表发送一些电子邮件时,我收到此错误.假设它发送10封邮件而1则发出错误,然后发送更多邮件并给出相同的错误.
代码如下所示:
public static bool SendEmail(string toMail, string fromname, string from, string subject, string body, string BCC)
{
MailMessage mailmessage = new MailMessage("frommail@mail.com", toMail, subject, body);
mailmessage.IsBodyHtml = true;
mailmessage.BodyEncoding = Encoding.GetEncoding(1254);
mailmessage.SubjectEncoding = Encoding.GetEncoding(1254);
SmtpClient objCompose = new SmtpClient("xxxx");
try
{
objCompose.Send(mailmessage);
return true;
}
catch (Exception ex) {
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
而我得到的错误是这样的:
System.Net.Mail.SmtpException:服务不可用,关闭传输通道.服务器响应是:4.4.2 mailer.mailer.com错误:在System.Net.Mail.MailCommand.Send上的System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode,String response)超出超时(SmtpConnection conn,Byte [ ]命令,在System.Net.Mail.SmtpTransport.SendMail(MailAddress发件人,收件人MailAddressCollection,在System.Net.Mail.SmtpClient.Send字符串deliveryNotify,SmtpFailedRecipientException&除外)从字符串)(消息MAILMESSAGE)
任何人都可以请求帮助,这个错误杀了我.
提前致谢.
我需要帮助将我的"用户定义的表类型"参数传递给动态sql,sp_executesql.
这是我的示例代码:
DECLARE @str as nvarchar(Max)
DECLARE @IDLIST AS ListBigintType /* this is my table type, with ItemId column (bigint)*/
INSERT INTO @IDLIST
SELECT DISTINCT bigintid FROM tableWithBigInts WITH(NOLOCK)
set @str ='select * from SomeTable where ID in (select ItemId from @IdTable) '
EXEC sp_executesql @str , @ParamDefs, @IdTable = @IDLIST
Run Code Online (Sandbox Code Playgroud)
它说:必须声明表变量"@IdTable"
我不能让这个工作,并且无法得到coalesce(对于bigints)的解决方法,因为结果将超过8000个字符.
我用TFS遇到了这个问题,我连接到错误的网络并尝试打开一个解决方案,它给出了错误:"无法连接到tfs".很好,我关闭了解决方案,然后我切换到了正确的网络,现在它说"解决方案似乎受源代码控制,但绑定缺少bla bla."
我检查了团队资源管理器选项卡,它显示它已连接,但解决方案是,项目在某种程度上对tfs失去了兴趣.
当我说"更改源代码管理"并尝试"绑定"所有项目时,它会要求检查每个项目,但我现在不想处理冲突,我需要当前检出的文件.
有没有人面对这个问题并解决它?
binding ×1
channel ×1
parameters ×1
request ×1
server-side ×1
smtp ×1
sql ×1
tfs ×1
timeout ×1
transmission ×1
wcf ×1