|
Hi All,
I have a WCF Service (Ex name: MyWCFService) which has all the database access and business logic mechanism, which is hosted in IIS using BasicHttpBinding. This WCF service is created by me. One of my collegue also created a WCF service called JasonProxyService which consumes MyWCFService, converts the result into Jason and gives it to UI, UI is using Ajax. The JasonProxyservice doesnt have configuration (like in web config it doesnt have elements <services>, <service> etc, which is unusual for me), and this JasonProxyservice has only two files .svc and svc.vb added to an asp.net application which has the UI also (the asp.net application has all the UI and ajax etc). There is no interface for contract, the ServiceContract attribute is defined right on top of the class and the methods in the class are defined with OperationContract attribute on top of them. When I tried to add interace and define it as service contract and put the WCF service configuration in the webconfig file, simply the Ajax isnt working. Then I left that option.
The reason for keeping JasonProxyService and UI in the same project is to avoid cross domain, becuase Ajax doesnt allow cross domain and our organization also not interested in cross domain because of security. The developer who wrote JasonProxyservice has left the project. Now it has come to my plate. This is what the problem is. I am really struggling with it for a while.
For solution, as first step I wrote logger to understand what is the problem, I am getting the below exception, and I am new to the json world. Please help me. Below is my exception, any help would be really helpfull.
System.ServiceModel.ProtocolException: The content type text/html of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>500 - Internal server error.</title>
<style type="text/css">
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
'. ---> System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at WA.LNI.StayAtWork.Public.Web.StayAtWorkServiceReference.IStayAtWorkService.SetContactInfo(UserInfo userInfo)
at WA.LNI.StayAtWork.Public.Web.StayAtWorkServiceReference.StayAtWorkServiceClient.SetContactInfo(UserInfo userInfo) in D:\source\SourceCode\StayatWork-VS2010\WA.LNI.StayAtWork.Public.Web\WA.LNI.StayAtWork.Public.Web\Service References\StayAtWorkServiceReference\Reference.vb:line 2848
at WA.LNI.StayAtWork.Public.Web.JSONProxyService.SetContactInfoJSON(UserInfo dto) in D:\source\SourceCode\StayatWork-VS2010\WA.LNI.StayAtWork.Public.Web\WA.LNI.StayAtWork.Public.Web\JSONProxyService.svc.vb:line 359
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
That's like finding a needle in the haystack. I would start the debugger up again and F9 the lines below,add some watches and step through the values.
D:\source\SourceCode\StayatWork-VS2010\WA.LNI.StayAtWork.Public.Web\WA.LNI.StayAtWork.Public.Web\Service References\StayAtWorkServiceReference\Reference.vb:line 2848
D:\source\SourceCode\StayatWork-VS2010\WA.LNI.StayAtWork.Public.Web\WA.LNI.StayAtWork.Public.Web\JSONProxyService.svc.vb:line 359
|
|
|
|
|
Hi jkirkerx,
I resolved it, actually it was another problem so it was throwing exception because of a field in the database is not matching to what I am sending.
So that exception was unable to be read by the jason application. So this error.
Thanks for your suggestion.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
That's Great!
I get those to, but you have to start somewhere and check all the values before the exception is thrown. It's always the dumbest little thing.
Enjoy your weekend now
|
|
|
|
|
let me first show the code. here is the insert code:
try
{
sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
sql_connection.Open();
sql_command = new MySqlCommand("sp_add_support_ticket", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_command.Parameters.AddWithValue("param_support_incident_title", txtSubject.Text);
sql_command.Parameters.AddWithValue("param_email_address", txtEmailAddress.Text);
sql_command.Parameters.AddWithValue("param_support_ticket_description", txtMessage.XHTML);
int result_rows = sql_command.ExecuteNonQuery();
Session["message_title"] = "Thank you";
Session["message_title_Color"] = Color.Blue.ToArgb();
Session["message_text"] = "We have recieved your feedback and we will get back to you as soon as possible.";
Session["message_button_title"] = "Back";
Session["message_button_url"] = "Home.aspx";
Response.Redirect("Message.aspx", false);
}
catch (Exception exp)
{
Session["message_title"] = "Error";
Session["message_title_Color"] = Color.Red.ToArgb();
Session["message_text"] = "Unable to send your message. Please try again later.";
Session["message_button_title"] = "Back";
Session["message_button_url"] = Request.UrlReferrer.ToString();
Response.Redirect("Message.aspx", false);
}
finally
{
if (sql_connection != null)
{
if (sql_connection.State == ConnectionState.Open)
sql_connection.Close();
}
}
and this is my stored procedure:
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_add_support_ticket`(IN `param_support_incident_title` varchar(255),IN `param_email_address` varchar(255),IN `param_support_ticket_description` text)
BEGIN
INSERT INTO support_incidents (support_incident_title, email_address) VALUES (param_support_incident_title, param_email_address);
INSERT INTO support_tickets (support_incident_id, support_ticket_description) VALUES (LAST_INSERT_ID(), param_support_ticket_description);
END
now.... when I fill the form on help.aspx page i get the data insert properly..
BUT...............
It will also add a new row
in support_incodents table with "Thank you" in support_incident_title field
in support_tickets table with "We have recieved your feedback and we will get back to you as soon as possible." in support_ticket_description field
if you notice, the text added in the new row is taken from the Session variable! but I really don't understand why it's adding new row and how it's taking Session's variable?!!
please help..............
Technology News @ http://www.JassimRahma.com
|
|
|
|
|
Hello,
I'm developing as ASP.NET web application and I use Crystal report for visual studio 2010, I installed it on my machine.
the application work correctly on my machine, but not like this on the server.
after I upload it to the server I fond this error
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
I searched for "log4net" more and I found more releases
I upload it ot my bin folder on the server, but the error changed to:
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I didn't found any compatible assembly to my application,
I developed this web application into 32 bit OS, and I upload it to a server machine which use Window server 2008 R2 64 bit OS
is it has relation with the error?
and How can I correct that error?
at last where I can fount the compatible assembly log4net version 1.2.10.0?
thanks?
|
|
|
|
|
Hello,
I'm developing as ASP.NET web application and I use Crystal report for visual studio 2010, I installed it on my machine.
the application work correctly on my machine, but not like this on the server.
after I upload it to the server I fond this error
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
I searched for "log4net" more and I found more releases
I upload it ot my bin folder on the server, but the error changed to:
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I didn't found any compatible assembly to my application,
I developed this web application into 32 bit OS, and I upload it to a server machine which use Window server 2008 R2 64 bit OS
is it has relation with the error?
and How can I correct that error?
at last where I can fount the compatible assembly log4net version 1.2.10.0?
thanks?
|
|
|
|
|
Sir;
I don't understand. Did you upload a diffident version of the assembly than the one you use it in development?
if so,, then just copy the one from you development machine assembly cache and upload it to the server.
Help people,so poeple can help you.
|
|
|
|
|
thanks fro your reply
My Application work on the local host without this assembly, but fire an error on the server, this error say:
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
I downloaded the assembly from the internet and upload it to the server, then another error say:
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
how can I solve this error and where I found the compatible assembly log4net version 1.2.10.0?
|
|
|
|
|
Man;
On your local machine the assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' runs from the Global Assembly Cache[^].
You should copy it and upload it to the server.
Good Luck
Help people,so poeple can help you.
|
|
|
|
|
Many thank,
I will try it
|
|
|
|
|
I am going to develop application in ASP.NET MVC. I know there are no rich controls.
Could you please recommend me good controls for that (datagrid, calendar, scheduler, numeric textbox, etc.)?
Thanks in advance
|
|
|
|
|
Free no good
|
|
|
|
|
Free and good controls are the jquery ui controls
|
|
|
|
|
|
How to use update panels in asp.net mvc? What is the best practice and library for that?
|
|
|
|
|
I'm using microsoft asp.net self updatepanel. and it's very good
|
|
|
|
|
If you are working with MVC framework, why dont you try out Ajax instead of update panels. Thats a much better option
|
|
|
|
|
HI All,
Please Explain me , if we select dropdownlist automatically get second dropdownlistDetails and if we select second dropdown list automatically get third dropdownlist details. my dropdownlist control present in gridview(EditItemTemplate field) like this...
<Columns>
<asp:TemplateField HeaderText="CID">
<ItemTemplate>
<%#Eval("CID")%>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="catep" runat="server">
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="CatId">
<ItemTemplate>
<%# Eval("CatId")%>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="cat" runat="server">
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="CateSubId">
<ItemTemplate>
<%# Eval("CategorySubId")%>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="subcat" runat="server">
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
Thanks&&Regards,
S.Hemanth
|
|
|
|
|
|
Yes..
Just to be clear the Cascading Drop Down is part of AJAX.
|
|
|
|
|
|
I need ur help on this. AM developing a windows application with vb.net and sql server database file(.mdf). After am through with the project, i decided to publish it using clickonce. But whenever i deploy the application, it wont save the record into the database.
|
|
|
|
|
Hi,
This is an ASP.Net forum. You will get more help (and quicker if you put in in the Windows forum). You also might want to describe what you mean by "it won't save to the database" (e.g. errors you are getting etc) as there is a lot that can go wrong between the user clicking the button (or whatever) and the database completing the update.
|
|
|
|
|
I have the following class code to add support ticket:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MySql.Data;
using MySql.Data.MySqlClient;
using System.Configuration;
using System.Globalization;
using Microsoft.Win32;
using System.Diagnostics;
using System.Reflection;
using System.IO;
using System.Security.Cryptography;
using DevExpress.Web.ASPxUploadControl;
using System.Drawing;
using System.Net;
using System.Net.Mail;
using System.Text;
namespace volow
{
public class create_support_ticket
{
MySqlConnection support_sql_connection = null;
MySqlCommand support_sql_command = null;
public void add_support_ticket(string support_incident_title, string email_address, string support_ticket_description)
{
support_sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
support_sql_connection.Open();
support_sql_command = new MySqlCommand("sp_add_support_ticket", support_sql_connection);
support_sql_command.CommandType = CommandType.StoredProcedure;
support_sql_command.Parameters.Add("param_support_incident_title", MySqlDbType.VarChar).Value = support_incident_title;
support_sql_command.Parameters.Add("param_email_address", MySqlDbType.VarChar).Value = email_address;
support_sql_command.Parameters.Add("param_support_ticket_description", MySqlDbType.Text).Value = support_ticket_description;
int result_rows = support_sql_command.ExecuteNonQuery();
support_sql_command.Dispose();
support_sql_connection.Close();
HttpContext.Current.Session["message_title"] = "Thank you";
HttpContext.Current.Session["message_title_Color"] = Color.Blue.ToArgb();
HttpContext.Current.Session["message_text"] = "We have recieved your feedback and we will get back to you as soon as possible.";
HttpContext.Current.Session["message_button_title"] = "Back";
HttpContext.Current.Session["message_button_url"] = "Home.aspx";
if (!HttpContext.Current.Request.Path.EndsWith("Message.aspx", StringComparison.InvariantCultureIgnoreCase))
HttpContext.Current.Response.Redirect("Message.aspx");
}
}
}
and I am calling it from the webform like this:
protected void btnSend_Click(object sender, EventArgs e)
{
if (txtMessage.Text == "")
{
Session["message_title"] = "Error";
Session["message_title_Color"] = Color.Red.ToArgb();
Session["message_text"] = "Please enter your message.";
Session["message_button_title"] = "Back";
Session["message_button_url"] = Request.UrlReferrer.ToString();
}
create_support_ticket create_support_ticket = new create_support_ticket();
create_support_ticket.add_support_ticket(txtSubject.Text, txtEmailAddress.Text, txtMessage.XHTML);
}
but I am getting two rows added for every insert! Thsi first row is correct as per the passed information but the second row adding the Session["message_title"] as support_incdent_title and the Session["message_text"] as support_ticket_description and I really don't know how??
here is my stored procedure:
INSERT INTO support_incidents (support_incident_title, email_address) VALUES (param_support_incident_title, param_email_address);
INSERT INTO support_tickets (support_incident_id, support_ticket_description) VALUES (LAST_INSERT_ID(), param_support_ticket_description);
|
|
|
|
|