A Socket Operation Was Attempted To An Unreachable Host / How To Fix This Error
Jun 5, 2010
I'm calling Another url from my web aspx page. I'm writing
[code]....
But I'm getting error
A socket operation was attempted to an unreachable host 208.101.14.59:80
I tried the same url by pasting it on address bar and works fine. When I call my vendor they r saying that there is no any problem from their side. Someone has suggested me that there may be some settings in web.config.
I write code for sending mail. Its working fine in local  at Execution time. After i Hosted into server. it shows the Error.
A socket operation was attempted to an unreachable host [IP]:587
code:
Dim mail As New MailMessage mail.To.Add("xxx@abc.com") mail.From = New MailAddress("yyy@gmail.com") mail.Subject = "Subject" mail.IsBodyHtml = True mail.Priority = MailPriority.High
I have a function that finds a files MIME type for download purposes. I use this DllImport:
Code: [DllImport("urlmon.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = false)] static extern int FindMimeFromData(IntPtr pBC, [MarshalAs(UnmanagedType.LPWStr)] string pwzUrl, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.I1, SizeParamIndex = 3)] byte[] pBuffer, int cbSize, [MarshalAs(UnmanagedType.LPWStr)] string pwzMimeProposed, int dwMimeFlags, out IntPtr ppwzMimeOut, int dwReserved);
I use this function:
Code:
#region GetMimeFromFile(string) public static string GetMimeFromFile(string file) { IntPtr mimeout; if (!File.Exists(file)) { throw new FileNotFoundException(file + " not found."); } //if int maxContent = (int)new FileInfo(file).Length; if (maxContent > 4096) { maxContent = 4096; } //if byte[] buff = new byte[maxContent]; using (FileStream fs = new FileStream(file, FileMode.Open)) { fs.Read(buff, 0, maxContent); } //using int result = FindMimeFromData(IntPtr.Zero, file, buff, maxContent, null, 0, out mimeout, 0); string mime = Marshal.PtrToStringUni(mimeout); Marshal.FreeCoTaskMem(mimeout); return mime; } #endregion
Locally, it runs fine. However, when I put it on a GoDaddy server, I get the error:
"The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. "
My stracktrace points to line 256, which is the ending french bracket of my GetMimiFromFile function.
I use dynamic currency symbol(Doller,£,etc.,) for that the web config is updated in locally but in site I can not modifiy the web config file and I get the following error
i have an dll file which is data access layer of my application.
i am getting this exception while accessing databse
Description:
The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission contact your system administrator or change the application's trust level in the configuration file.
Exception Details:
System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Security Exception Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.Local its run fine. when i place in iis. it throw this exception.
Server Error in '/' Application. Attempted to read or write protected memory. This is often an indication that other memory is corrupt.Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Am using socket connection to send and receive values. The following code is used to receive response.
[Code]....
In the above code, am facing a prob in skt.Available. If i dont give the thread.sleep, it is not repeating the while loop and it exits after onetime. And if i dont give skt.Available line, sometimes it throws socket Exception. I do not want to use thread.sleep. Does anyone knows why this is happening and how can i resolve this?
I am using asp.net framework 2.0. I am facing following error message "Attempted to read or write protected memory. This is often an indication that other memory is corrupt" For more detail Plz see the attached file.
Error Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.....
I have both VS 2005 and 2008 installed on my machine. 2005 is fine. For 2008, literally any asp.net project I try to create gets this eror. I try stepping into the code, and the error occurs apparently before anything that I can trap is loaded. There is no information written to the event log. I have tried this with a "Hello World" webpage with nothing else going on. Seems unique to my Windows Server 2003 machine.
in my case, It is the windows service which in running the long running insert/update on a table and I need to cancel the operation from my ASP.NET application. In the above link Burnsys suggests that one should kill the Sql server session. Is that really only way and a goood practice to do this? Also, in the same poset can use SqlCommand.Cancel to cancel. However, I am not sure how can I cancel the command from the windows service from ASP.NET application.
I'm about ready to deploy an MVC web application that I've been tasked with managing (I did not create the application). The project is now compiling in production mode with no errors, however I have some warnings - 9 to be precise.
Now 6 are to do with the test project which is fine, however there are two that involve the Web project. these errors are:
Unreachable code detected
In both instances these warnings are thrown on the Return value, e.g.
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { if (true) { return new ValidationResult("Passwords don't match", new string[] { OriginalProperty }); } return null; }
In the above example, the "return null" line throws the unreachable code warning.
This might be a silly question (so please go easy ;-) ), but how important are these warnings to the functionality of the application? Obviously they are there for a reason, but they're not errors, so would I be relatively okay to ignore them and deploy?
I am using static class to do every job related to Database. In this class Connection Object is static but i am creating command object in the method. I read a form post here [URL] about creating connection object local. If we do like that how can we use Connection pooling? There is an example code below.
I am creating a connection object with pooling (Validate Connection=True; Min Pool Size=10; Max Pool Size=200; Incr Pool Size=10; Decr Pool Size=5;). I am expecting to use connection pool by static connection object (this obje has a connection poll) with dynamicly created commands. Am I wrong? Sometimes i am getting "System.InvalidOperationException: Operation is not valid due to the current state of the object." error. Is it because static connectin object?
Dim roommates = From p In dbroom.Residents _ Where p.room = queryStudent.First.r.id _ Where p.building = queryStudent.First.b.id _ Where p.year = year _ Where p.semester = term _ Select p.person_name
It currently returns no results. I was getting an error when attempting to bind this resultset (since it was empty) to a repeater in ASP.NET, so I attempted to escape it:
If roommates.Count() = 0 Then Dim nomates As String = "No current roommates." rptrRoommates.DataSource = nomates rptrRoommates.DataBind() Else rptrRoommates.DataSource = roommates rptrRoommates.DataBind() End If
But I still get the same error:
The method 'First' can only be used as a final query operation. Consider using the method 'FirstOrDefault' in this instance instead.
guys, i have an application that uses Active Directory Authentication and deployed the application several days ago without any error. Today, I got this error.please refer to the image. I find it weird because I didn't change any code to my webconfig file since i deployed the application to the server. I've notice that it's working if it's [URL](by opening the source file in server and debug it) however when i try to access the application through [URL] I'm getting this error. I'm using 2.0 framework And here's my web.config
i write script to add meta information to mp4 video, when my script try to add mp4 meta information to mp4 file. I/O Error arises and operation terminated possibly cause of "no permission to open file". which permission is required to solve this issue. I am using ASP.NET. windows 7.
I have one asp.net application , when i run this application in the visul studio it run successfully But when i deploy this aaplication and run from iis its show me this error: "Operation must use an updateable query" I am using VWD 2008 express edition database: Foxpro