By Tim Wheeler on
7/26/2008
Generally I am developing in a virtual enviornment, normally VMWare. I had difficulty working away from the office through the company VPN. I also had difficulties authenticating as we had a seperate development domain. This post explains the steps to setup the VPN configuration and process for logging in.
Read More »
|
By Tim Wheeler on
7/17/2008
I was trying to Unit Test my WCF Service, and for some crazy reason Visual Studio 2008 would issue a stop command to the IIS Admin service and the World Wide Web Publishing service, right before the unit test called the wcf service. As VS had cleverly stopped the services hosting my WCF service, the call subsequently failed with:
Test method [method] threw exception: System.ServiceModel.EndpointNotFoundException: Could not connect to http://localhost/WcfService/v1/MyService.svc. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:80. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:80.
Found nothing to help me understand why VS behaved this way. I found that if the WCF project was unloaded the unit test would succeed. Interestingly enough a college was having another issue with WCF not using the proxy settings defined in the config. And found a good link about why here: http://blogs.infosupport.com/porint/archive/2007/08/14/Configuring-a-proxy_2D00_server-for-WCF.aspx
Originally I thought this may have been a similar cause, then my college found that turning off code coverage solved the problem. Open your localtestrun.testrunconfig and remove the code coverage checks. But now I'm not so sure as I still have the issue.
|
By Tim Wheeler on
7/16/2008
Had an issue today with a Windows Form. Visual Studio showed it as a .cs file. Double clicking on it showed the code rather than the form designer. I think this is caused by our form inheriting from a DevExpress form. The fix is to right click on it, exclude it from your project, click "Show All Files" and include it again.
|
By Tim Wheeler on
7/9/2008
I was trying to pass an XmlNode as a parameter in my WCF Service. Didn't think this would be an issue but I kept getting the error:
Type 'System.Xml.XmlNode' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.
I found a like on what types you can use with the DataContractSerializer here: http://msdn.microsoft.com/en-us/library/ms731923(VS.85).aspx
So it support only an Array of XmlNode, WHAT?! Ok, fine so then we use XmlElement instead, or pass in an array with 1 item.
|
By Tim Wheeler on
7/7/2008
Recently I encountered a slight issue with the Import Scripts function on the Visual Studio 2008 database project.
Situation:
I was receiving the following error when executing one of my stored procedures in SQL Server 2005.
INSERT failed because the following SET options have incorrect settings: 'ANSI_NULLS, QUOTED_IDENTIFIER'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods.
Reason:
The stored procedeure has TSQL syntax that required:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Cause:
This was only occuring after I did a Deploy from the database project in visual studio. When I built the SP, and when I re ran my original SP script manually everything worked fine. It seemed that the database project was altering these settings. What I found is that the ScriptsIgnoredOnImport.sql contained the two SET options that my SP required, and when the database project deployed, it obviously didn't use those SET options.
Fix:
This probably sounds really obvious but here it is:
In the database project select your stored procedure in the solution explorer, bring up the properties windw (F4), and set the ANSI nulls property to On and the Quoted Identifiers property to On. (Stop laughing now ok)
A bug? Well I'm sure MS would say this is a Feature, but it seems that the Import Script function ignores the SET options for the stored procedure imports.
|
By Tim Wheeler on
6/25/2008
I have a .Net implementation of SRW/SRU if anyone is interested. At some point I was looking at putting it online but just don't have the time at the moment. If your looking at creating an SRW/U project in .net, leave a comment and I might be able to help. For those that don't know about SRW its a way to query systems using standardised interfaces and metadata schemas. So either XML Webservices or Xml from an HttpRequest. View more info at www.loc.gov/z3950/agency/zing/srw.
Its also used in Federated Search, currently supported Te Ara www.teara.govt.nz. Their SRU interface is here: www.teara.govt.nz/search/sru.axd. A number of New Zealand and Australian educational institues also support it for federated search.
|
By Tim Wheeler on
6/24/2008
I recently got to use the new database project in Visual Studio 2008 on a client project. What a great improvement. True it has a few quirks, but basically it removes a whole bunch of manual steps that we had to do in Visual Studio 2005. I've found the DB project great in a team environment, when you want to work local and still source control your database scripts. It has a cool feature called "Import Scripts", in which is parses the TSQL, breaks everything up into individual scripts, and places them in the appropriate folders. It also gives you the ability to write your own scipts. To do that, you need to update Scripts/Post-Deployment (or Pre-Deployment)/Script.PostDeployment.sql.
Use the command ":r .\MyCustomScript.sql"
BTW, it generates an SQL script (in the SQL folder) as an output of the project. It contains your entire database in one scipt. However it is SQLDMO so you can't execute it in the management studio or query analyzer, you need to use the sqldmo command:
osql -S localhost -d DatabaseName -i myscript.sql -E (The parameters you need will be different depending on your script)
The database project allows you to create data generation plans, which is great for filling up the database after you create it.
Here is my current approach to using database projects:
- Use it in a team environment to deploy and develop locally
- Deploy from Visual Studio (right click deploy) in development environments.
- Don't use VS to deploy to production or UAT, use the script. (Which you will probably have to customise)
- Set the database to be re created on each deployment.
- Have a post build script that will insert your reference or lookup data.
- Have a data generation plan to create you some base entity data to work with.
- Use the Import Scripts method carefully, (it depends how you generate your scipts)
- Version control with TFS/VSS or whatever.
Quirks:
- Current RTM version of VS 08 keeps the database project loaded entirely in memory. Best bet is to keep this project unloaded (right click, unload from solution explorer) when you don't need it.
- It also seemed to have a bug where it didn't understand default values on the table scripts, and ended up erroring because it would try and apply constraints twice. To fix this, look at how you are generating your table SQL, and update as needed.
- Data generation plan does not always work, keep trying. Also, check your timeout settings etc on your connections.
|
By Tim Wheeler on
6/24/2008
I was trying to define labels for the content type in a document library. I kept getting the error:
"The label reference, MetaDataFieldName, could not be found"
The column did exist but the error persisted. So I turned off labels, set the auditing values and saved the policy. I then went back into the policy and defined the labels and it worked. Not sure why, but it seems you have to create and save the policy first, then return and add labels.
|
By Tim Wheeler on
6/23/2008
I have just uploaded the Code Artist for DotNetNuke module and added it to the Code Zone. This module isn't available publicly yet but will hopefully be ready in a month. The code zone is being constantly updated and contains reusable classes or examples. Best of all its all Free Code, courtesy of www.purecoding.net.
|
By Tim Wheeler on
6/16/2008
Here is a common IIS error. 401.1 - Unauthorized: Access is denied due to invalid credentials. Here is one possible resolution.
If an ASPNet site requires authenticated users, but your not using Integrated Windows Authentication then you might get a 401.1 error, with a login dialog that never accepts credentials no matter how many times you enter them.
In IIS, edit the website or folder, click the Directory Security tab. Make sure Integrated Windows Authentication is ON. If you are still getting this error, it maybe that the account your app pool is running under does not have permission to files or registry keys. Try turning on both Anonymous, and Integrated, or grant more permissions to your service account. If your system impersonates, the requesting user will need permissions to whatever the site needs, like writing to the file system. Not a very nice situation. Its better to run under a service account and just impersonate when you need to.
Also try running:
Cd %systemroot%\Microsoft.NET\Framework\v2.0.50727
aspnet_regiis –ga [domain]\ServiceAccount
|