WCF / ASMX :: Access Operation Context In A MessageEncoder?
Jul 20, 2010
I'm implementing a MessageEncoder as described at MSDN
Is there a way to access the request, channel, or operation context from a MessageEncoder? I want to be able to save data for C# code to access after deserialization.
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.
These types of exceptions always irritate me because they are almost impossible to reproduce consistently and have almost no documentation other than the cryptic error itself to have any idea on how to fix the problem. So I have a Windows Service that makes a call to a .asmx web service over https on a polled interval every 20 minutes. Once in a great while the following exception message is returned:
Message: The underlying connection was closed: An unexpected error occurred on a receive.
Inner Message: System.IO.IOException: The decryption operation failed, see inner exception. ---> System.ComponentModel.Win32Exception:
The specified data could not be decrypted --- End of inner exception stack trace --- at System.Net.Security._SslStream.ProcessReadErrorCode(SecurityStatus errorCode, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest, Byte[] extraBuffer) at System.Net.Security._SslStream.ProcessFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.StartFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.TlsStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
So from reading the above message there was an error on receive and the data could not be decrypted. The does not occur consistently, so I don't have a good way of reproducing it. I also lack at low level messaging knowledge and I feel that this is the answer behind this exception; i.e. dropped packets and an incomplete message not appearing to be the same message as sent from the service or something. Any .asmx gurus out there that can give insight and possibly prevention suggestions for the above issue?
I have a method in wcf which returns stream of custom object. I need to deserialize this stream at client side, but my custom class which is exposed as data contract is not visible through client proxy. When I add a dummy operation contract which returns the custome object I am able to get this custom class. I dont want to write this dummy method as there are many such custom classes.
Is there any way to expose data contract without writing any operation contract that returns or accepts data contract type object?
I know this has been asked umpteen times but i cant find an answer to my problem. Very simply, i have a webservice client which is trying to call a webservice. The webservice may take any time from 5mins to 30mins (or more) for downloading message data from pop3 server . However after 2mins i get the following error:
System.Net.WebException: The operation has timed-out
This is an issue with the webservice client timing out calling the webservice - as the underlying webservice still runs in the background Sequence osf steps when the error occurs:
1.User logins with his credentials 2.Webservice client calls webservice to connect to pop3 server and download messages for that particular user.
Code in webservice for downloading data from pop3 server where the exception occurs
private string ReadOutput(bool bMultiline) { try { StreamReader srReader = new StreamReader(conn); string strRet = srReader.ReadLine(); if (bMultiline) { // Example #4: Append new text to an existing file string strLine = ""; while (true) { // In a multiline message the . indicates end of message if (strLine == ".") break; // Relay will convert any line with just a . in it to .. if (strLine == "..") strLine = "."; strRet += " " + strLine; } } return strRet; } catch (Exception e) { return null; } }
3.Exception is caught in webservice client while webservice continues to run.This exception occurs only when the user receives a large message may be above 1mb because i tested with 1MB msg file where i dint have any problem receiving or downloading from pop3 server where as with 5 MB message file i got this exception .
After going through couple of forums i tested my luck by changing web.config in both webservice and webservice client where i set the attribute of httpruntime Execution timeout to 300 seconds with no success <httpRuntime
executionTimeout="300"></httpRuntime>.
I have this webservice client and webservice running on localmachine(OS-Windows Vista)
I have an object defined by my entity framework model that has navigation properties, but whenever the navigation property is null, entity framework seems to try to pull it down again from the database. This is fine for now and I can work on this problem later, but when it tries to get the navigation property from the database, I get the error from the model:The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
Well this isn't too good that it's blowing chunks like this. Is there anything I can do to ensure that this is only attempted when the context is still open?
Currently i am developing ASP.NET AJAX server control in which i am using jquery code. Inside jquery event, i wish to access the microsoft ajax object. If it is not clear, find the below code example,
I have a webpage that you pass in an id parameter (via a querystring), which it then uses to fetch data from a database. Typically, a user would navigate to this page from another page that lists only those records that the user has access to. However, if they go directly to the page by typing in the URL in the Address Bar, they can effectively view any record they like. to type something like http://localhost/TestSite/ClientAdmin/ManageLocation.aspx?LocationID=5 into their Address Bar, they can access the database record with the LocationID equal to five - even though they shouldn't have access to it
I have a static class with serveral static methods. In these methods, I'm trying to access the current thread's context using HttpContext.Current. For example:
var userName = HttpContext.Current.User.Identity.Name;
However, when I do that, I receive a NullReferenceException, the infamous "Object reference not set to an instance of an object."
I'm getting a strange data download from an Access database.Using Visual Web Developer 2010 Express, I created a web service that places records from an Access database in server cache and then reads the records, one at a time, from the cache. The data in the records is converted to a delimited string. The web service is called from an e-learning program called Toolbook that places Http Post calls to the web service. The web services uses vb and .Net Framework 2.0.
All works correctly with one exception. When a record in the Access db contains "&", it is downloaded to the Toolbook e-learning program as "&". If I place && in the record, I get "&&".If I download the data from the Access db using a classic.asp file rather than the web service, the "&" displays correctly.
I executed the following sql command, and got error "Operation must use an updateable query.".
[Code]....
The database is access 2003. The tables are T1 (code (key), n) and T2 (code(key),num). Why do I get this error and how do I solve it? EDIT: Found solution somewhere else.
I get this error when trying to access a self hosted wcf service...
[Code]....
Can someone explain what I need to do to get this to work, I do not have any cross domain policy file. And don't know how that is supposed to look like.
I have a simeple web service set up to call from JAVASCRIPT. That works. Can someone tell me how to access profiles from a web seervice. I get arofileCommon could nt be found......I have included the following in the service but it doesn't seem to solve the problem:
I need to update a online class that is using Asp.net as it's base. I have to use flash because the test will use video as the teaching tool. I want to be able to communicate with a database to update scores through choices made in the flash programmed test. I am woundering if there is a easy way to do or not. I am a begginer in asp, but well versed in flash.
am new to webservice accessing from javascript.I call a webmethod from javascript which returns a string array. whith this array i bind a dropdown list at client.At dropdownList selectedIndexchanged event I found there is no item in DropDownList. Is there any way how to bind the DropDownList using webMethod so that on postback i can get the dropdowns item.