Cherwell Global Conference 2016 (#CGC2016)

Last week, I (and three other colleagues) had the opportunity to attended the Cherwell Global Conference 2016 event in Colorado Springs at The Broadmoor resort. It was the first time attending this event so we didn’t know what to expect but we had a great time and learned a lot.

Although, I haven’t had much experience with Cherwell, attending the CGC2016 really made me super excited to learn more about it. I really got the “Apple” vibe during the event (especially during the KeyNote).

Overall, I think Cherwell delivered, the event was impressive. For the Cherwellians that helped make the event possible, you guys did a great job!

Shout out to the following training PROs for providing a great class experience with tons of good information:  

  • Mike McMullen
  • Brian Schoner
  • Kevin Kraus

WCF – An existing connection was forcibly closed by the remote host

If you’ve run in to the following error message in your WCF service:

System.ServiceModel.CommunicationException:    An error occurred while receiving the HTTP response to https://YourDomain.com/Service.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

You most likely already spent many hours trying to debug the exception. This happen to me and I searched Google and read through tons of threads, most about updating the following attributes in Web.Config/App.Config on the Server/Client:

  • maxReceivedMessageSize
  • maxStringContentLength
  • maxBufferSize
  • maxArrayLength
  • maxBytesPerRead
  • maxDepth

Others recommended enabling tracing on the client and on the server. None of these suggestions helped me… So I sat and banged my head against the wall for a few more hours and thought “What was different about this particular service method as compared to my other methods in my WCF service?“.

It turns out, my issues was actually really simple to resolve but the error message had nothing to do with the actual issue at hand. All the methods in my WCF service return custom entities (classes) and in this particular method one of the properties was of type DataTable.

The issue all along was that I wasn’t giving the DataTable a Name.

DataTable dt = new DataTable(“TheName”);

I hope this helps you guys save sometime.

Happy coding! 🙂

SSRS Export RDL to a File from Report Server

I’ve been getting a lot of requests lately for help with exporting a report to a file in SQL Server Reporting Service (SSRS). The focus of this tutorial will be to show you guys how you can export a report from your Report Server.

Please note, this tutorial will not show you how to export an RDLC (client-side) report.

The first thing we need to do is setup up our Visual Studio .NET project:

  1. Download ReportHelper zip and extract the wrapper C# class ReportHelper.cs into your project.
  2. You will need to add a service reference to your Report Server execution web service (e.g. http://YourServerName/ReportServer/ReportExecution2005.asmx).
  3. Alternatively, you can use the VS.NET WSDL tool to extract a C# proxy class and add that to your project (I’ll provide instructions on how to do this further down).

Once you’re all setup, create a new VS.NET MVC or Web Forms project.

MVC:  Create the following action method in your HomeController:

public FileContentResult ExportReport()
{

var @params = new List<ReportingServices.ParameterValue>();
@params.Add(new ReportingServices.ParameterValue() { Name = “ParameterName”, Value = “YourValue”});

var report = new NunoSolutions.Report();
report.ReportServerUrl = “http://YourServer/ReportServer”;
report.ReportPath = “/Home/Report1”; // This is the report server path to your report
report.ExportParameters = @params.ToArray(); // can be excluded if your report doesn’t have parameters
report.ReportTitle = “Your Report Name”;
report.ReportFormat = “Excel”;
return NunoSolutions.ReportHelper.ExportMVC(report);

}

WebForms:  Create new button called “Button1” and connect the “Click” event to the following method:

protected void Button1_Click(object sender, EventArgs e)
{

var @params = new List<ReportingServices.ParameterValue>();
@params.Add(new ReportingServices.ParameterValue() { Name = “ParameterName”, Value = “YourValue”});

var report = new NunoSolutions.Report();
report.ReportServerUrl = “http://YourServer/ReportServer”;
report.ReportPath = “/Home/Report1”; // This is the report server path to your report
report.ExportParameters = @params.ToArray(); // can be excluded if your report doesn’t have parameters
report.ReportTitle = “Your Report Name”;
report.ReportFormat = “Excel”;
NunoSolutions.ReportHelper.Export(report);

}

You’re done, go ahead and run your project. If you configured everything correctly, your report should get exported to Excel format.

Here’s how you can generate the SSRS proxy class:

  1. Open VS.NET Command Prompt
  2. Enter CD  C:\Temp  and press enter (this will be the location where the proxy file will be created)
  3. Execute the following command to generate the SSRS proxy class (make sure you change the report server name to your server’s name): wsdl /out:ReportExecutionService.cs http://YourReportServerName/ReportServer/ReportExecution2005.asmx?WSDL
  4. In Visual Studio, add C:\Temp\ReportExecutionService.cs file to your project

Click Here for more information on how to export a C# Proxy class using Microsoft’s WSDL utility.

 

Windows 8.1 – Network Connectivity & new Start Button

Microsoft finally added the Start button to Windows 8.1 and I finally installed it.

Network Connectivity

After upgrading to Windows 8.1, I struggled with the Wi-Fi Network connectivity. In the Wi-Fi popup screen (click the Wi-Fi icon in the task bar) kept saying limited network connectivity with the little exclamation mark next to the Wi-Fi connection. It took me a while but I finally resolved the issue by opening Device Manager and uninstalling the Wi-Fi network drivers and then reinstalling them (reinstalling the drivers without uninstalling them from Device Manager first did not work for me).

Again, as I’ve said in the past, I really like Windows 8, this is not a bashing session. However, at the same time there are certain things about Windows 8/8.1 that just make me wonder “Why?”:

Pros & Cons IMO

1st, things I like about Windows 8.1:

1. I have a duel screen setup and my main screen is on the right side. I like that I no longer have to aim my mouse just perfectly at the bottom left edge of the main screen just to go to access the start screen because MS finally added a start button (I have issues with the start button too but more on that in the next section).

2. I like the new options and customization that you get from the metro GUIs.

3. The computer management menu where you previously had to right click the bottom most left edge of the screen now contains shutdown options (shutdown, sleep, hibernate, etc…) 

2nd, things I do not like about Windows 8.1:

1. In order to view the computer management (right click) menu, you have to right click the start button… it would have mad a lot more sense  if you just left click the start button and the menu appears.

2. The computer management (right click) popup menu is so plain and ugly… just seems like MS rushed to add it and didn’t spend anytime on it. MS should have invested just a little bit of time to make it look more integrated and pretty (similar to the Windows 7 popup menu without the “All Programs” menu & recent programs)

3. Start button brings you directly to the start screen instead of popping up a menu. I don’t understand why the start button simply brings up the start screen if there are many other methods to achieve the same thing:

  • Press the Windows Key on the keyboard
  • If the PC is a tablet (like a surface) just press the start button on the screen itself
  • Bring up the Charms > Start button

This is how the start button should work:

  • Double clicking should bring up the Start Screen
  • Single clicking should popup the computer management menu

Anyway, this is my two cents, thanks for reading.

-Nuno

Windows 8 Settings Gear Box Icon

I have to say, Windows 8 is really a great product but what would make it even better would be a Settings icon somewhere on the taskbar. Once you’ve used it for a few weeks and really get used to it, it starts growing on you. At home I only use Windows 8 but at the office we still use Windows 7 and Windows XP. This week for the first time I found myself sitting at my desk pressing the Windows Key trying to bring up my Start Screen and thinking to myself “wow, I totally forgot I’m on Windows 7, Duh!”.

I’ve seen a lot of threads with people complaining about Windows 8 mainly because of the missing start button and number of clicks it takes just to shutdown their PC. Anyway, this article isn’t to talk about how many click or taps it takes to do something rather it is a suggestion for Microsoft that I think would make a huge difference in the user experience. Most people I’ve spoke with don’t really care about the start button menu rather they want a quick way to access certain Windows Features. For example, there should be a way to enabled an icon or button somewhere on the taskbar that provides quick and easy  access to Power features, Control Panel, Search, and Administrative Tools (for the techy folk). The hidden menu at the bottom left hand corner of the screen just doesn’t cut it. This is especially true if you have dual monitors where the right monitor is your main and the left is your secondary. This is my setup and the mouse seems to always want to move over to my second screen so I have difficulty accessing the hidden menu… its such pain in that you know what. 

Here’s what I think would be a perfect solution to this problem. Add a Gear Box Icon to the bottom left of the screen where the old START button used to be and show a cut down version of the Start Menu. For example, here’s a mockup screenshot of what I think that menu should contain. We don’t need the program list or recent programs list on this menu. I really think this would improve the Windows 8 experience and also stop most of the commotion all over the internet relating to the start button.

 

Holla back if you agree,

Nuno

Start Button App v1.1 for Windows 8

I’ve been using Windows 8 since the Consumer Preview and have really grew to love it. I’ve seen a lot of posts about people wish they could still have their start button in windows 8. Below is a freeware app I wrote for myself in .NET 4.5 that will provide similar functionality.


Here’s how you install it:

1.    Download the StartButtonApp_v1_1.7z files below and extract it to your desktop

2.    The zip program should create a directory called StartButtonApp and in that directory there should be a StartButtonApp.exe file

3.    Right click the StartButtonApp.exe and click Pin to Taskbar

4.    Move the StartButtonApp icon to the desired location on your taskbar and you should be all set

 

[EDIT: NunoP]

A newer version of the Start Button App was posted that allows users to customize the menuitems that get displayed. To modify the menuitems, simply open the menu.xml file and modify it as per your requirements.

Here’s what the default menu.xml file looks like:

<MainMenu>

<MenuItem

name=Administrative Tools

command=control.exe

arguments=admintools

position=1 />

<MenuItem

name=Control Panel

command=control.exe

arguments=“”

position=2>

<MenuItem

name=Add/Remove Programs

command=rundll32.exe

arguments=shell32.dll,Control_RunDLL appwiz.cpl,,0

position=1 />

<MenuItem

name=Display Properties

command=rundll32.exe

arguments=shell32.dll,Control_RunDLL desk.cpl,,3

position=2/>

<MenuItem

name=Mouse Properties

command=rundll32.exe

arguments=shell32.dll,Control_RunDLL main.cpl,,0

position=3/>

<MenuItem

name=Power Options

command=rundll32.exe

arguments=shell32.dll,Control_RunDLL powercfg.cpl

position=4/>

<MenuItem

name=System Properties

command=rundll32.exe

arguments=shell32.dll,Control_RunDLL Sysdm.cpl

position=5/>

<MenuItem

name=Device Manager

command=rundll32.exe

arguments=devmgr.dll DeviceManager_Execute

position=6/>

</MenuItem>

<MenuItem

name=Shutdown

position=3>

<MenuItem

name=Shutdown

command=shutdown.exe

arguments=-s -t 00

position=1 />

<MenuItem

name=Restart

command=shutdown.exe

arguments=-r -t 01

position=2/>

<MenuItem

name=Log Off

command=shutdown.exe

arguments=-l -f

position=3/>

</MenuItem>

</MainMenu>

To add HIBERNATE and SLEEP, simply add the following two line of code underneath the Log Off element to the menu.xml file:

<MenuItem

name=Hibernate

command=rundll32.exe

arguments=PowrProf.dll,SetSuspendState

position=4/>

<MenuItem

name=Sleep

command=rundll32.exe

arguments=powrprof.dll,SetSuspendState 0,1,0

position=5/>

 

·      Now runs on top of .NET 3.5 (instead of 4.5)

·      The menu is now customizable via an XML file 

The StartButtonApp app is totally free so enjoy.

Nuno F. Pereira

‘Sys is undefined’ Error in .NET 2.0 and AJAX 1.0 Extensions

If you’re using ASP.NET 2.0 and try to use ajax, you may experience the error ‘Sys is undefined’. If this is the case for you, you’re most likely just missing some configurtion settings in your web.config. To fix your web application, just copy and paste the web.config settings that are missing in your app’s web.config file from the web.config file that’s in ASP.NET Extensions directory (mine is C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025).

Start Button App for Windows 8

I’ve been using Windows 8 since the Consumer Preview and have really grew to love it. I’ve seen a lot of posts about people wish they could still have their start button in windows 8. Below is a freeware app I wrote for myself in .NET 4.5 that will provide similar functionality.

Here’s how you install it:

1. Download the StartButtonApp.zip files below and extract it to your desktop

2. The zip program should create a directory called StartButtonApp and in that directory there should be a StartButtonApp.exe file

3. Right click the StartButtonApp.exe and click Pin to Taskbar

4. Move the StartButtonApp icon to the desired location on your taskbar and you should be all set

Click this link to download the app:   StartButtonApp.zip (7.88 kb)

Have fun with it and happy holidays! 🙂

-Nuno

ASP.NET Compilation Error – “[No relevant source lines]”

If you’re beating your head against the wall trying to figure out why you can’t run your ASP.NET web applications then you’ve come to the right place. This happen to my computer after removing a cycbot trojan. Here’s what you have to do to get it working again:

 

1.       Open Windows Explorer and browse to [root]:/Windows/Temp

2.       Right click the Temp folder then click Properties from the popup menu

3.       Select the Security tab

4.       Click Edit then Add

5.       Find and select IIS_IURS

6.       Click OK then select Full control then OK again

 

That’s it, test your ASP.NET app and it should compile and run error free.

 

-Nuno

Install Cisco AnyConnect VPN on Windows 8 x64

I’ve tested this on Windows 8 Pro x64 only (I’ve not tested this on x86 versions of Windows 8). Please make sure to backup the registry key we are going to modify in the instructions below before modifying it.

1.    You company will give you a URL where you can install the Cisco AnyConnect VPN Client from… In Windows 8 you might get “Page cannot be displayed” if you try to load the website via Internet Explorer 10. To properly install it successfully, useFirefox (IE will not work, not sure about Chrome)

2.    Edit your registry by pressing Windows Key + R

3.    Type RegEdit then press Enter

4.    Find HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vpnva

5.    Double click on the DisplayName

6.    Delete everything before “Cisco AnyConnect VPN Virtual Miniport Adapter for Windows x64” and save the DisplayName value

7.    Test your VPN client and now you will no longer get a VPN driver error that you were getting on Windows 8

 

EDIT:   After a reboot, I received an error message but was able to get passed it by performing the following:

  1. Open the Services MMC (Window Key + R then type “services.msc” and press enter)
  2. Stop the Internet Connection Sharing (ICS) service
  3. Open the Cisco AnyConnect VPN Client and login

 

-Nuno