在我们的业务范围内,我们托管基于REST的API,由Windows Azure托管,SQL Azure作为数据库存储.
Web角色(Windows 2008R2,IIS 7.5,WCF,大型实例)和SQL Azure都托管在北欧地区.
问题是,当我们进行密集的SQL工作时,我们经常会遇到"Timeout expired.在操作完成之前超时时间已过,或者服务器没有响应." .
让我感到困扰的是,无论我们做什么,我们都无法在我们的内部部署SQL服务器(SQL Server 2008R2)上引发这种情况.
任何帮助澄清这个谜团的人都会受到赞赏,因为似乎Web角色实例并不是直接与SQL Azure实例交谈,尽管两者都位于北欧.
更详细的例外:
<SqlException>
<Message>Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.</Message>
<StackTrace>
<Line>at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)</Line>
<Line>at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()</Line>
<Line>at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)</Line>
<Line>at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()</Line>
<Line>at System.Data.SqlClient.SqlDataReader.get_MetaData()</Line>
<Line>at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)</Line>
<Line>at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)</Line>
<Line>at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, …Run Code Online (Sandbox Code Playgroud) 我已经尝试了很多来自Azure的CDN,并且在使用web角色成功设置后我认为我是安全的.
为什么是网络角色?
好吧,我想要使用普通的blob方式获得压缩和缓存标头的好处.并作为额外的奖励; 区分大小写的约束也被消除了.
足够选择CDN服务 ; 虽然之前的所有内容都是从同一个域提供的,但我现在或多或少地提供来自cdn.cuemon.net的所有"静态"内容.从理论上讲,这应该可以提高性能,因为与一个域相比,浏览器并行可以在"多个"域上传播内容收集.
不幸的是,这导致性能下降,我相信在提供内容之前(使用tracert命令)与滚刀的数量有关:
C:\Windows\system32>tracert -d cdn.cuemon.net
Tracing route to az162766.vo.msecnd.net [94.245.68.160]
over a maximum of 30 hops:
1 1 ms 1 ms 1 ms 192.168.1.1
2 21 ms 21 ms 21 ms 87.59.99.217
3 30 ms 30 ms 31 ms 62.95.54.124
4 30 ms 29 ms 29 ms 194.68.128.181
5 30 ms 30 ms 30 ms 207.46.42.44
6 83 ms 61 ms 59 ms 207.46.42.7
7 65 ms 65 ms 64 ms 207.46.42.13
8 65 …Run Code Online (Sandbox Code Playgroud) 我现在已经调查了过去两小时的400-BadRequest代码.很多sugestions用于确保正确设置bindingConfiguration属性,在我的例子中,它是.
现在,在摧毁我所在的建筑物之前,我需要你的帮助:-)
我运行WCF RestFull服务(非常轻量级,使用此资源获取灵感:http://msdn.microsoft.com/en-us/magazine/dd315413.aspx),它(现在)接受通过提供的XmlElement(POX) POST动词.
在实现真正的客户端之前,我目前只使用Fiddler的请求构建器(因为这是混合环境).
当我为小于65K的XML执行此操作时,它工作正常 - 更大,它会抛出此异常:已超出传入消息的最大邮件大小配额(65536).要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性.
这是我的web.config文件(我甚至包括了客户端标签(绝望的时候!)):
<system.web>
<httpRuntime maxRequestLength="1500000" executionTimeout="180"/>
</system.web>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
</diagnostics>
<bindings>
<webHttpBinding>
<binding name="WebHttpBinding" maxReceivedMessageSize="1500000" maxBufferPoolSize="1500000" maxBufferSize="1500000" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00">
<readerQuotas maxStringContentLength="1500000" maxArrayLength="1500000" maxBytesPerRead="1500000" />
<security mode="None"/>
</binding>
</webHttpBinding>
</bindings>
<client>
<endpoint address="" binding="webHttpBinding" bindingConfiguration="WebHttpBinding" contract="Commerce.ICatalogue"/>
</client>
<services>
<service behaviorConfiguration="ServiceBehavior" name="Catalogue">
<endpoint address=""
behaviorConfiguration="RestFull"
binding="webHttpBinding"
bindingConfiguration="WebHttpBinding"
contract="Commerce.ICatalogue" />
<!-- endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" / -->
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="RestFull"> …Run Code Online (Sandbox Code Playgroud) 我有一个非常奇怪的问题; 在我们的REST应用程序中,我们引入了一个上传WebPackage的选项.由于这些在解压缩时可能相当大,我们希望通过MemoryFailPoint确保内存检查的成功经验.
在我的本地IIS 7.5上,这可以完美地工作 - 甚至可以达到最大值.预期值2GB.在我们的IIS 7.5虚拟Windows Server 2008R2 x64上,无条件失败 - 即使只尝试1MB.
虚拟服务器托管在VMWare ESXi 4.1.0,348481上.
以下是虚拟机上失败的示例代码:
using (MemoryFailPoint failPoint = new MemoryFailPoint(1))
{
... // deliberately excluded webpackage code
}
Run Code Online (Sandbox Code Playgroud)
和异常(在XML中):
<InsufficientMemoryException>
<Message>Insufficient memory to meet the expected demands of an operation, and this system is likely to never satisfy this request. If this is a 32 bit system, consider booting in 3 GB mode.</Message>
<StackTrace>
<Line>at System.Runtime.MemoryFailPoint..ctor(Int32 sizeInMegabytes)</Line>
<Line>at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)</Line>
<Line>at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)</Line>
<Line>at …Run Code Online (Sandbox Code Playgroud)