Showing posts with label ASP.Net Deploying Problems. Show all posts
Showing posts with label ASP.Net Deploying Problems. Show all posts

Wednesday, October 29, 2014

Report cannot be Displayed

Error:
- Event not fired.
- Microsoft.Reporting.WebForms.HttpHandlerInputException: Missing URL parameter: IterationId
(This is only part of the long error message).
- Report loads forever (never stops loading).

Solution:
On the aspx page, add attribute: EnableEventValidation="false"

For my particular case, I was trying to display a report (SSRS), and it never stopped loading. However, for my case, it was because of the version of the Internet Explorer (yes, the report is only compatible with IE for mine). After changing the version of the IE through developer tool (F12), I managed to display the report properly. You can also try to display the report from another machine using the intended IE version to see if it displays properly.
Share:

Monday, April 8, 2013

An Error Occurred While Parsing EntityName

Error: An Error occurred while parsing EntityName. Line 17, position 211.

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.

Exception Details: System.Xml.XmlException: An error occurred while parsing EntityName. Line 17, position 211.

Source error: responseXml.LoadXml(response)

This error occurs because there is an ampersand (&) in the returned XML command.

Solution: Use “and” or other conjunctions instead of ampersand (&). Another option is to replace the string containing & with "%26".
Share:

Thursday, November 29, 2012

Could not Load Type from Assembly

Error:
Could not load type 'xxxxxx' from assembly 'AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

This error occurs when trying to open a webpage. The project is built successfully. However, when accessing particular page, the error pops out. The error message is actually quite long. This is only part of the error message.

Solution:
On Visual Studio, go to menu Tools -> Options -> Debugging -> General -> Disable "Enable Just My Code" options.

PS: I am not sure if there is another more feasible solution. This might only be a workaround. There could be side effects. As of now, it is still working fine after this option is disabled.

Update:
Looks like this does not really solve the issue. I find out that if the project or solution is rebuilt, it will go to normal when the web is run. If it doesn't, rebuild, then try it again.

However, when the web is run on debug mode, some pages will get this error, thus not viewable. Another workaround is to view the web in browser (not in debug mode), then attach the process to the web. On Visual Studio, after the web is viewed in browser, go to menu Tools -> Attach to Process -> look for the web server process under which the web is run, e.g. WebDev.WebServer20.EXE
Share:

Friday, September 28, 2012

Conflict in Namespace

Error:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30175: module 'ContextMenuHelpers' and module 'ContextMenuHelpers', declared in 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\metroweb\87c204db\55321c07\App_Code.rcey62l6.13.vb', conflict in namespace ''.

Source Error:



Line 3:  
Line 4:  Public Module ContextMenuHelpers 
Line 5:  
Line 6:      'Public SysMsg As GlobalResources.SystemMessages = New GlobalResources.SystemMessages()




Solution:
This problem occurs because more than one file of the same class with the same namespace are found in the folder, usually App_Code folder. If you back-up the source files, make sure it is renamed as another extension, so that it does not conflict with the original file. Otherwise, either put your back-up files outside of the application, or archive it in a compressed file.

In the case I encountered, someone puts a back-up file in a new sub folder inside the App_Code folder. After renaming the extension of the back-up file, the problem is solved.
Share:

Friday, July 20, 2012

The Server Was Unable to Process The Request Due to an Internal Error

Error:
Message: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.
This error usually occurs when the application uses web service or similar technologies.

Solution:
The solution may vary, depending on the issue faced. One thing for sure, there is one way to make sure the exact technical error of the message.

Open the web.config or app.config file of the application, then search for serviceDebug tag, then change the includeExceptionDetailInFaults attribute to true.

<serviceDebug includeExceptionDetailInFaults="false" />

Afterwards, reproduce the error. The exact technical error message should be displayed.
Share:

Wednesday, May 9, 2012

Access to Temp Directory is Denied

Error:
When deploying application and viewing the web page, the following error occurs:
Access to the temp directory is denied.
Identity 'IIS APPPOOL\WebAppPool' under which XmlSerializer is running does not have sufficient permission to access the temp directory. CodeDom will use the user account the process is using to do the compilation, so if the user doesnt have access to system temp directory, you will not be able to compile. Use Path.GetTempPath() API to find out the temp directory location.

Solution:
Go to IIS, change advanced settings of the application pool used for the website, then under Process Model Category, change the Identity to ApplicationPoolIdentity.
Share:

Cannot Display Web Page on IIS due to Configuration Error

Error:

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

Config Error: There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined
Config File:  Application\Web\web.config

The error on IIS 7.5 should look like this.


Solution:
Open web.config, and then comment out the "system.web.extensions" sectionGroup under configSections tag.
For example:
<!--<sectiongroup name="system.web.extensions">
............
............
...........
</sectiongroup>-->
Share:

Thursday, March 22, 2012

Data Type Exception Error

Error:
This is only part of the errors, since it is quite long, I will just quote the core part.

System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.InvalidOperationException: DataReader.GetFieldType(5) returned null.

This happens when I deploy a web application developed under Visual Studio .Net 2010 using SQL Server 2008 R2 for the database. The query used happen to retrieve fields of type hierarcyid. It works on other machines, this is the first time I encountered such error.
After searching through the internet, I found a solution in a thread on MSDN forum.

Seems that not only for table with field of CLR data type: hierarchyid, fields of Spatial type: geometry and geography also could result in such error.

Solution:
Add the file C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Types.dll to the project (as a reference), or simply copy the DLL file to the bin folder in which the project is deployed.

Reason:
According to the post, it seems that the new SQL Server 2008 data types are not native .NET data types. On the machine where the application is deployed to, the DLL file was not available, so the DataAdapter can't initialize the data types correctly.
Share:

Thursday, April 14, 2011

Root Element is MIssing

Error:
System.Xml.XmlException: Root element is missing.
Solution:
If you are using Web Service, check if the URL of the web service is properly set.
For example:
The URL for the web service is
http://localhost:8081/WebName/WebService.asmx

The error occurs when the URL used is, for instance:
http://localhost:8081/WebName
Share:

Friday, November 6, 2009

Disabling web.config inheritance for child application

Error:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'Control' or one of its dependencies. The system cannot find the file specified. (d:\Web\VS\Website\web.config line 82)

Source Error:

Line 77: <httphandlers>
Line 78: <remove path="*.asmx" verb="*">
Line 79: <add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false">
Line 80: <add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false">
Line 81: <add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false">
Line 82: <add path="SecurityImageHandler.ashx" verb="*" type="Control.SecurityImageControlHandler, Control">
Line 83: </httphandlers>



Solution:
I have an application which has a child (sub folder) application in it. In my case, I added a tag in the parent application:

<add path="SecurityImageHandler.ashx" verb="*" type="Control.SecurityImageControlHandler, Control">



When deployed, an error occurs in the child application, since the assembly added in the parent application is also recognized by the child application. To avoid the child application from reading the tag added on the parent application, we have to remove the tag on the web.config of the child application.

After adding the code to remove the tag, it will look like this:

<httpHandlers>
...........
...........
<remove verb="*" path="SecurityImageHandler.ashx"/>
...........
...........


Share:

Wednesday, November 4, 2009

Error uploading file in ASP.NET

Error:
XML Parsing Error: no element found
Location: http://10.21.9.12/Web/UploadFile.aspx
Line Number 1, Column 1:
^

This error occurs because the size of the file uploaded is too big and not handled in the web.config.

Solution: add this tag to the web.config in the <system.web></system.web> section:

<system.web>
<httpRuntime maxRequestLength="2048000">
</system.web>



There's a limitation used in the maxRequestLength. 2048000 is the value I use in VS 2008. If I'm not mistaken, in VS 2003, the maxRequestLength is 1024000. Note that this value is in KB (Kilo Byte).
Share:

Tuesday, June 30, 2009

Validation of viewstate MAC failed

Error : Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machinekey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

Solution : Add this part to the web.config System.Web section:
<pages enableEventValidation="false" viewStateEncryptionMode ="Never" enableViewStateMac="false" />
Share:

Thursday, June 18, 2009

Error with web service

Error variations:
- No connection could be made because the target machine actively refused it.
- The request failed with HTTP status 404: Not Found

Solution : Check whether the URL for the web service is set properly.

This problem appears to be a debugging problem when web service is used for desktop application. Yet, it appears to be a deploying problem when the web service is used for web application.
Share:

Tuesday, June 16, 2009

Logon failed on Crystal Report

Error : Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: Login failed for user 'UserXXX'. SQL State: 42000 Native Error: Error in File E:\TEMPSY~1\Tmp\temp_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.rpt: Unable to connect: incorrect log on parameters.

Solution : Open the report, then Verify Database, using the login used while deploying!

This error takes me a lifetime to solve. It actually doesn't make sense to verify database for a report using the real login while deploying. That means all reports created while developing will have to be verified. The login info should be able to be set programmatically.

In my case, there are already some pages on the web that use similar reporting. I've printed the report using the same code, but no matter how I try, none works. I've tried a lot of ways to make it print, but all to no avail.

At last, I verify the report using the login used while deploying, then re-upload it. It works fine. phew -.-""""""

I set the login information for the report from web.config:

<!--<add key="ConnectionInfo" value="Database_name, server, user, password">-->
<add key="ConnectionInfo" value="DB1, 10.20.20.9, steven, steven"||/add>



Here's the .cs code I use for the report, and it should work fine, I guess.

private void BindConnectionInfo()
{
ConnectionInfo connectionInfo = new ConnectionInfo();
string conInfo = SystemConfiguration.ConnectionInfo; //get from web.config

connectionInfo.DatabaseName = conInfo.Split(',')[0].Trim();
connectionInfo.ServerName = conInfo.Split(',')[1].Trim();
connectionInfo.UserID = conInfo.Split(',')[2].Trim();
connectionInfo.Password = conInfo.Split(',')[3].Trim();

TableLogOnInfo t = new TableLogOnInfo();
t.ConnectionInfo = connectionInfo;

if (crystalViewer.LogOnInfo.Count == 0)
{
crystalViewer.LogOnInfo.Add(t);
}
crystalViewer.EnableDatabaseLogonPrompt = false;
crystalViewer.EnableParameterPrompt = false;
}


protected void btnPrint_Click(object sender, EventArgs e)
{
litXXX.Text = "";
//Print
BindConnectionInfo();

ReportDocument rd = new ReportDocument();
rd.Load(Server.MapPath("../../Report/report_name.rpt"));

ParameterDiscreteValue value = new ParameterDiscreteValue();
value.Value = Period;
ParameterValues parameterValuesPriod = new ParameterValues();
parameterValuesPriod.Add(value);

value = new ParameterDiscreteValue();
value.Value = Convert.ToByte(Semester);
ParameterValues parameterValuesSem = new ParameterValues();
parameterValuesSem.Add(value);

ParameterField parameterField = rd.ParameterFields[0];
parameterField.DefaultValues = parameterValuesPriod;
parameterField.CurrentValues = parameterValuesPriod;

parameterField = rd.ParameterFields[1];
parameterField.DefaultValues = parameterValuesSem;
parameterField.CurrentValues = parameterValuesSem;

crystalViewer.ReportSource = rd;
crystalViewer.DataBind();
}



And here's the .aspx code:

script type="text/javascript">
<!--
function PrintPartsViewer()
{
var objWindow = window.open("about:blank", "print", "width=800, height=600, toolbar=no");
var strHtml = "<html>";
strHtml += "<head>";
strHtml += "</head>";
strHtml += "<body>";
var element = document.getElementById("divPrint");
strHtml += element.innerHTML;
strHtml += "</body>";
strHtml += "</html>";
objWindow.document.write(strHtml);
objWindow.document.close();
objWindow.print();
objWindow.close();
}
//-->
</script>

<asp:literal id="litXXX" runat="server"></asp:literal>

<asp:button id="btnPrint" runat="server" text="Print Report" onclick="btnPrint_Click" />

Share:

Monday, May 18, 2009

Error using Server.Transfer

Error : Invalid path for child request 'http://localhost/Content/foldername/pdf_filename.pdf'. A virtual path is expected.

I was using Server.Transfer on links to redirect the web to another page, and this error occured.

Solution : DO NOT user Server.Transfer when redirecting to another web server. Use Response.Redirect instead.
Share:

Friday, April 24, 2009

Crystal Report error while deploying

Error : Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its
dependencies. The system cannot find the file specified.


Solution : Install crystal report runtime available in Visual Studio CD, on the server.
Share:

Error while building on release mode

Error : "LC.exe" exited with code -1073741701

I was building a pre-compiled web in release mode (using WebDeployment program). As known, compiling in release mode always retrieves undiscovered errors -.-"""


Solution : Exclude licenses.licx file from project, then rebuild again.

There was a time when I faced the same problem, after my computer was attacked by a virus that caused the executable files became corrupted. In this case, just ask for a copy of LC.exe file from a friend and place it on the folder where LC.exe is located on the computer.
Share:

Ambiguous match found

Error :
Server Error in '/Web' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Ambiguous match found.

Source Error:

Line 1: <%@ Control Language="c#" AutoEventWireup="false"
Codebehind="GeneralTemplate.ascx.cs" Inherits="Web.Service.MasterPages.GeneralTemplate"

TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
Line 2: <%@ Register TagPrefix="uc1" TagName="MainMenu" Src="../UserControls/MainMenu.ascx" %>
Line 3: <%@ Register TagPrefix="Web" Namespace="Web.Web.Controls" Assembly="BLMS.BackEnd.Web.Controls" %>

Source File: /Web/MasterPages/GeneralTemplate.ascx Line: 1


This is actually a weird error, I've faced a lot of problems while deploying and debugging web application developed under asp.net, and these errors are sometimes not quite relevant to the error messages, so have to figure it out by myself. Phew...

Solution : Made a new web directory on IIS outside the default website, for the web application. And it worked like charm!! -.-"""
Share:

Username & Password requested when downloading

Problem : When downloading a file, username and password is requested.

Solution : If I'm not mistaken, I used impersonation on the web, so have to grant permission on the IIS. Go to control panel -> Administrative Tools -> Internet Information Services. Or simply press window + Run, then type inetmgr.

Right-click Default Web Site, properties, go to Home Directory tab, push button Connect as -> dialog box to fill username and password will be prompted, fill with the user used for impersonation.
Share:

Error displaying report

Error : C:\DOCUME~1\STEVEN~1\ASPNET\LOCALS~1\Temp\temp_c31eb8a4-2e63-4b42-b43d-c91550cca5b4 {25A8AD89-FCF3-4B82-A544-375DE1838F98}.rpt: Unable to connect: incorrect log on parameters

This problem is quite typical, and happen under some typical conditions. I was using crystal report to view a report on a web page, and the connection used for the report is ODBC. I had made the ODBC on User DSN tab, yet the error still occurred. Have to create ODBC on System DSN.

Solution : Add ODBC to System DSN (on the server where the application is located), and make sure the connection in the application is using valid username & password.
Share:

You may be intersted in

Related Posts

Updating Table Containing Xml Column via LinkedServer

If you are trying to update a table containing XML column via Linked Server in SQL Server, and you are not able to, you are not alone. There...

About Me

My photo
Is an ordinary man, with a little knowledge to share and high dreams to achieve. I'd be glad if I can help others, 'coz the only thing for the triumph of evil is for a good man to do nothing.

About Blog

You can find a lot of debugging and deploying problems while developing applications in .NET and Visual Basic here. There are also some querying tips in SQL and typical source codes which might be useful shared here.

Popular Posts

Blogroll

Followers

Leave a Message