I had previously installed Visual Studio 2015 Community Edition to do some Cordova development but was getting this message;
Oracle Java SDK A more recent version of this software is required
I downloaded the updated JDK but it wasn’t being recognised in my system. Information about this can be found here – https://msdn.microsoft.com/en-us/library/dn757054(v=vs.140).aspx#AdditionalTasks
If you modify any of the tools you are using then you need to ensure that your Environment Variables are configured correctly. A list of these variables are available here – https://msdn.microsoft.com/library/dn771551%20(v=vs.140).aspx#env_var
I chose to override the JAVA_HOME environment variable, instead of modifying them in the Computer Control Panel, to the latest version of the JDK I had installed – C:\Program Files (x86)\Java\jdk1.8.0_45. This resolved the issue for me.
This post just covers a few useful things I have found while I have been developing an ASP.NET Web API that uses AttributeRouting for Web API and ELMAH for Web API.
I found AttributeRouting much easier to configure and administer than using MapHttpRoute in the WebApiConfig.cs file; especially using the RoutePrefix at the controller level. Running tests on the attributes using the Route.axd was also very straight forward. I also found Fiddler (v22.214.171.124) to be very helpful in throwing different unit tests at my newly created web API. This is simple and powerful configuration that works straight out of the box.
Using the Elmah.Contrib.WebApi took a little more configuring to get working but I found a good place to start, after you had installed the NuGet packge was on the sample web.config page. This provides detailed examples of the configuration settings needed for the different types of log stores as well the basic settings for the different flavours of IIS. There were a couple of additional tweaks I would recommend:
- Since I am not generating any View I removed the
filters.Add(new HandleErrorAttribute()); in the FilterConfig. The HandleErrorAttribute to serve up a View called Error. Since this is a Web API project and I don’t have any Views then it wasn’t needed.
- Instead, there is a rather neat process for capturing unhandled errors that I found here.
- Finally, if you are using a simple XML file to store your errors you need to make sure that the security configuration is correct for the folder where the files will be generated and stored. For example, I had my files stored in the App_Data folder under the root of the web site on IIS 7.5. The application pool for this site was running under the ApplicationPoolIdentity account and so this account needed to have write permissions to the App_Data folder. Instructions for doing this can be found here under the Securing Resources section of the article.
When I first saw Visual Studio online being advertised I didn’t think it would be something I would use that much. However, in the process of creating a Windows Phone application I was reading about the availability of Team Foundation Server as part of the VS Online package. Since I was creating my application in VS 2013 on my machines at home it was great to find out that I could have my very own TFS setup in the cloud; not only that but its also FREE for the first five users. This allows me to have the useful features of TFS and know that my code follows me where ever I happen to be developing.
I still prefer my ‘on machine’ IDE for doing my development and doing it on my Surface 2 Pro has proved to be very effective. The performance of the machine is fantastic and with the all day battery life I can do as full days work on a single charge. The backlit keyboard on the Type 2 cover also helps when you have ideas in the middle of the night!
I was trying to add a new COM DLL to my VS2010 project but it kept giving me the following error message:
A reference to the “….dll” could not be added.Please make sure that the file is accessible and that it is a valid assembly or COM component
Then I realised I hadn’t registered my self-registering assembly on my machine as this was a new machine and the first time I had used this project. Since I had my VS Command Prompt open I ran RegSvr32 on the assembly and waited for the usual message. Instead it threw me an error and I was left to try and find out what was causing the problem. As it turns out the solution was relatively simple. I needed to run my command prompt as the administrator to get RegSvr32 to work as I am using a Windows 7 OS. Now my COM DLL is registered and listed in the COM tab of the Visual Studio Add Reference dialog.
I am a big fan of Silverlight, its just so much fun to develop with. However, time and tide wait for no man so I am glad MS has updated support for HTML5. I am sure I will get round to learning more about it soon…
I have been using IIS Express to do some of my recent development instead of using the ASP.NET Development Server so that I could use the additional functionality within IIS. (Personally, I hate developing with the ASP.NET Development server but I am having to develop on XP at the moment and IIS 5.1 is not much better. Getting IIS Express has been a real bonus.). I had configured my IIS site originally with a localhost address and Visual Studio debugging worked fine. Unfortunately, Fiddler doesn’t like monitoring localhost addresses so I created a new entry in my Hosts file to use localhost.
This created my second issue. When I tried to run my app within VS I got the ‘Unable to start debugging on the Web server’ error, IISExpress was reporting 401 errors and all because of the entry in the Hosts file. So after the usual search to try and find similar problems I came across this MSDN KB article. I actually used Method 2 in the article and I didn’t need to reboot my machine, just restart my IISExpress instance. This solved my problem as Visual Studio was then happy to go through the authentication process and Fiddler was capturing my Requests/Responses.
If you suffer the pain of using the ASP.NET Development Server (Cassini) and would like an alternative take a look at this post. The full download is available here.