Showing posts with label Error. Show all posts
Showing posts with label Error. Show all posts

Tuesday, November 8, 2011

Xap packaging failed. Object reference not set to an instance of an object.

If you face the error "Xap packaging failed. Object reference not set to an instance of an object." while trying to build your Windows Phone application, make sure you do not have any files added to your solution that no longer exist on disk.


In the image above, you can see the reference to banner.png is outdated and needs to be removed. Once you remove the reference, try rebuilding your app and it should build fine.

--
Paras Wadehra

Monday, January 10, 2011

Turn on IncludeExceptionDetailInFaults while connecting to a WCF service from a client.

While using a client to connect and fetch data from a WCF service, you may encounter an error and see the following message displayed on the screen:

Error: 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.System.Exception {System.ServiceModel.FaultException}

This happens when any type of error occurs calling a WCF endpoint from a client. The client sees this generic message, as given above, for security reason. If you want to see the full details of the error in the client, you will need to modify the config file of the WCF Host to include full exception details when sending the error to the client.
1.<configuration>
2.<system.serviceModel> 
3.  <services> 
4.    <!-- Step 1. Add a behaviorConfiguration attribute --> 
5.    <service 
6.      name="Microsoft.WCF.Documentation.SampleService" 
7.      behaviorConfiguration="metadataAndDebug"> 
8.      <host> 
9.        <baseAddresses> 
10.          <add baseAddress="http://localhost:8080/SampleService" /> 
11.        </baseAddresses> 
12.      </host> 
13.      <endpoint 
14.         address="mex" 
15.         binding="mexHttpBinding" 
16.         contract="IMetadataExchange" 
17.      /> 
18.    </service> 
19.  </services> 
20.  <behaviors> 
21.    <serviceBehaviors> 
22.      <!-- Step 2. Add a new behavior below.--> 
23.      <behavior name="metadataAndDebug"> 
24.        <serviceMetadata  httpGetEnabled="true" httpGetUrl=""/> 
25.      <!-- Step 3. Add a <serviceDebug> element --> 
26.    <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" /> 
27.      </behavior> 
28.    </serviceBehaviors> 
29.  </behaviors> 
30.</system.serviceModel> 
31.</configuration>
Please note that there is an inherent security issue if this setting is left to 'true' for your production environment. Please see the MSDN article here for more details.

Monday, October 12, 2009

Visual Studio 2005 debugger does not attach to application

This issue happens with IE8 as the browser used for debugging. IE 8 has a feature called Loosely-Coupled Internet Explorer (LCIE) (http://www.microsoft.com/windows/internet-explorer/beta/readiness/developers-existing.aspx#lcie) which results in IE running across multiple processes.

Older versions of the Visual Studio Debugger get confused by this and cannot figure out how to attach to the correct process.

To overcome this issue, you need to disable the process growth feature of LCIE by following the steps below:
1) Open RegEdit
2) Browse to HKEY_LOCAL_MACHINE -> SOFTWARE -> Microsoft -> Internet Explorer -> Main
3) Add a DWORD under this key called TabProcGrowth
4) Set TabProcGrowth to 0

If you run into the same problem on Vista or newer, you will also need to turn off protected mode.

Following the above steps should resolve your issue.

Regards,
Paras Wadehra

Saturday, November 8, 2008

Registry Editing has been disabled by your administrator

Many people face this error message when they try to open Registry Editor and they have a malware/spyware installed.

Thanks to http://windowsxp.mvps.org/tweakuirest.htm the following gives the solution for the same:

Removing the DisableRegistryTools restriction

For standalone Windows XP systems, perform the steps below to remove the registry editing restrictions.

Method 1: Using the REG.EXE console tool
1. Click Start, Run and type this command:
REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableRegistryTools /t REG_DWORD /d 0 /f

Please note that the above command is all one line, so please copy the complete command and then run it.

You should be able to launch Tweak UI, as well as the Registry Editor.

Method 2: Using the Group Policy Editor (Windows XP Professional only)
Click Start, Run and type gpedit.msc and press ENTER
Go to the following location:
User Configuration Administrative Templates System
Double-click Disable registry editing tools and set it to Not Configured
Exit the Group Policy Editor

Note: If the setting already reads Not Configured, set it to Enabled, and click Apply. Then revert it back to Not Configured. This ensures that the DisableRegistryTools registry value is removed successfully.

Spanish version of the article is here.

Friday, October 3, 2008

The XML page cannot be displayed

This is a very common error people face when installing ASP.Net applications.

You finish installing the app and go to the corresponding URL in the browser and you see this error message "The XML page cannot be displayed. Cannot view XML input using XSL style sheet. Please correct the error and then click Refresh button, or try again later. A name was started with an invalid character. Error processing resource 'http://servername/applicationname/'."

This is caused due to the fact that the .aspx and .asmx extensions are not registered in your IIS website properly. Perform the following steps to remedy the solution:

1) Open IIS (Start->Run->inetmgr)
2) Right click your website (virtual directory) and select properties.
3) Click the configuration button.
4) In the Application Configuration screen, click add and browse to the path 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll' and in the Extension box type '.aspx' and click ok. Perform this step again for the .asmx extension pointing to the same executable file.
5) Click OK and close the properties box.

Now test your website and it should work fine. Please note that the above steps are for IIS 5.1, but the steps in IIS 6.0 mimic these closely.

Hope this helps!