.net-4.0

Method not found: 'Void System.Web.UI.ScriptResourceDefinition.set_LoadSuccessExpression(System.String)'

…衆ロ難τιáo~ 提交于 2020-01-21 13:44:11
问题 When trying to deploy the web application 4.0 on to the server it is giving this error, although its working fine on the local machine having IIS7 回答1: The LoadSuccessExpression property is a new property in .NET 4.5. Since your host only supports .NET 4, this property does not exist when deployed. It works on your local machine since .NET 4.5 is an in-place upgrade to .NET 4. If you install Visual Studio 2012, this property will be found and not give exceptions locally. 来源: https:/

Method not found: 'Void System.Web.UI.ScriptResourceDefinition.set_LoadSuccessExpression(System.String)'

喜夏-厌秋 提交于 2020-01-21 13:43:55
问题 When trying to deploy the web application 4.0 on to the server it is giving this error, although its working fine on the local machine having IIS7 回答1: The LoadSuccessExpression property is a new property in .NET 4.5. Since your host only supports .NET 4, this property does not exist when deployed. It works on your local machine since .NET 4.5 is an in-place upgrade to .NET 4. If you install Visual Studio 2012, this property will be found and not give exceptions locally. 来源: https:/

Method not found: 'Void System.Web.UI.ScriptResourceDefinition.set_LoadSuccessExpression(System.String)'

别来无恙 提交于 2020-01-21 13:43:41
问题 When trying to deploy the web application 4.0 on to the server it is giving this error, although its working fine on the local machine having IIS7 回答1: The LoadSuccessExpression property is a new property in .NET 4.5. Since your host only supports .NET 4, this property does not exist when deployed. It works on your local machine since .NET 4.5 is an in-place upgrade to .NET 4. If you install Visual Studio 2012, this property will be found and not give exceptions locally. 来源: https:/

Upload a file MVC 4 Web API .NET 4

£可爱£侵袭症+ 提交于 2020-01-21 03:14:10
问题 I'm using the version of MVC that shipped with Visual Studio 2012 express. (Microsoft.AspNet.Mvc.4.0.20710.0) I assume this is RTM version. I've found plenty of examples online which all use this code: public Task<HttpResponseMessage> PostFormData() { // Check if the request contains multipart/form-data. if (!Request.Content.IsMimeMultipartContent()) { throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); } string root = HttpContext.Current.Server.MapPath("~/App_Data"); var

Async logging throwing a NullReferenceException

点点圈 提交于 2020-01-21 03:06:27
问题 I am trying to asynchronously log some information to SQL Server inside of an MVC 4 controller action targeting .NET 4.0 using the AsyncTargetingPack. I would jump straight to .NET 4.5 but my app lives in Azure and we're still waiting for the update... This code works as expected (a row is written to my database with no exceptions thrown): public class SystemActionLogger : ISystemActionLogger { private readonly ActionBlock<Tuple<SystemAction, object>> actionBlock; public SystemActionLogger

Returning a single property from a LINQ query result

北城余情 提交于 2020-01-20 21:06:19
问题 The following expression returns a contact - the whole contact with dozens of properties. This is fine but, ideally, I'd like the return to be the contact's id (contact.contactId) property only. How do I do this? var assocOrg = Contacts.Where(x => x.ContactTypeID == 2 && x.OrganizationName == "COMPANY XYZ"); 回答1: var result = Contacts.Where(x => ...) .Select(x => x.ContactID); or var result = from x in Contacts where x.ContactTypeID == 2 && x.OrganizationName == "COMPANY XYZ" select x

Check if directory exists on Network Drive

那年仲夏 提交于 2020-01-19 05:38:06
问题 I'm trying to detect if the directory exists, but in this particular situation my directory is a network location. I used VB.NET's My.Computer.FileSystem.DirectoryExists(PATH) and the more general System.IO.Directory.Exists(PATH) , and in both cases, the system response is false. I checked and the PATH exists, I can view it in MyComputer Folder. If I debug the program, and watch the My.Computer.FileSystem.Drives variable, the network location does not appear in that list. UPDATE: I checked

Thread.Sleep vs Task.Delay?

非 Y 不嫁゛ 提交于 2020-01-19 03:09:25
问题 I know that Thread.Sleep blocks a thread. But does Task.Delay also block? Or is it just like Timer which uses one thread for all callbacks (when not overlapping)? (this question doesn't cover the differences) 回答1: The documentation on MSDN is disappointing, but decompiling Task.Delay using Reflector gives more information: public static Task Delay(int millisecondsDelay, CancellationToken cancellationToken) { if (millisecondsDelay < -1) { throw new ArgumentOutOfRangeException(

Thread.Sleep vs Task.Delay?

喜你入骨 提交于 2020-01-19 03:09:17
问题 I know that Thread.Sleep blocks a thread. But does Task.Delay also block? Or is it just like Timer which uses one thread for all callbacks (when not overlapping)? (this question doesn't cover the differences) 回答1: The documentation on MSDN is disappointing, but decompiling Task.Delay using Reflector gives more information: public static Task Delay(int millisecondsDelay, CancellationToken cancellationToken) { if (millisecondsDelay < -1) { throw new ArgumentOutOfRangeException(

Can I differentiate a timeout from a message size issue using only CommunicationException?

若如初见. 提交于 2020-01-17 11:11:11
问题 Folks, I hit the following exception and I know for a fact that its not a timeout issue and that its a message size issue. Using ONLY the CommunicationException, is there a way to tell that this issue was a message size issue and not a timeout issue? Perhaps one of the properties on CommunicationException? or maybe it can be cast in a certain way? I'm willing to explore any proposals. System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an