If you have execution permission error when you run your ASP.NET, assigning dbreader and dbwriter roles to the ASPNET user will not help, especially your application only uses stored procedures. dbreader and dbwriter serve no purpose for this. They are related to table access. In this case, you need the following statement (if you're using SQL 2005).
GRANT EXECUTE ON SCHEMEA::dbo TO ASPNET
Monday, July 20, 2009
dbreader and dbwriter
Why GRANT EXECUTE ON SCHEMEA?
GRANT EXECUTE ON SCHEMEA::dbo TO ASPNET
By default schema is owned by dbo (any member of the sysadmin fixed sever role), which is different from db_owner (fixed database role).
If you don't specify schema on the table when you create it, the schema will be created under dbo privileges. The schema of the default LocalSqlServer database ASPNETDB is usually under dbo. Most of time, you need to run GRANT EXECUTE ON SCHEMEA statement.
What this statement does is to grant ASPNET
- to execute stored procedures in the dbo schema.
If you change your mind later after you have granted the EXECUTE permission, you can always use REVOKE to remove the previous granted (or denied) permission, e.g.,
REVOKE EXECUTE ON SCHEMEA::dbo TO ASPNET
You can also use DENY statement to prevent someone from having certain permissions.
Can't View CHM Files
Whenever a CHM file is not viewable, I usually can go Properties of that file, click Unblock and then view the file. But this method suddenly doesn't work for me today because there is no Unblock button available.
I found that all the CHM files under that particular directory are not viewable. They were all working fine in the past and I also remember that I unblocked all those files. I am not sure if it is related to my most recent security update last week. The interesting is that, as soon as I copied those CHM files outside that directory, they become all viewable again. It is weird. Those CHM files are not in the network but my local drive. Well, the good thing is that the problem is solved.
In normal situation, see KB902225 to resolve CHM un-viewable issue.
Sunday, July 12, 2009
Verify who is ASP.NET Logon User
Usually I use Request.LogonUserIdentity.Name to check ASP.NET Logon User. It works for all types of users.
System.Web.HttpContext.Current.User.Identity.Nameor
Request.ServerVariables["AUTH_USER"]
are only for Windows Authenticated user. For Internet users (anonymous guest), empty string is expected.
Request.LogonUserIdentity.Name will show you if the user is anonymous.
Monday, June 22, 2009
BeVocal vs Voxeo - Which one is good for a beginner?
Recently I have been learning ccxml and vxml. To begin with, I chose to do ccxml. But I recognized that I had to understand how vxml works before I could do something on ccxml. So in the past 2 weeks, I've begun working on vxml.
I signed up two free accounts with BeVocal and Voxeo respectively. Here are my simple comparison as an IVR beginner.
Category | BeVocal | Voxeo |
---|---|---|
Customer Support and Forum |
Worst! I have never got a response from them. I guess they are not entertaining any free account members. If so, they should mention this in their site. In addition, I am still unable to access their news forum discussion groups either. | Extremely efficient, fast response. I have no problem to access their forum discussion boards. |
Text to Speech (TTS) | Sound more natural. I've seldom needed to do some customization in code in order to get a better speech. | BeVocal sounds better than Voxeo, especially in reading a long sentence or a paragraph. A short sentence or a few words interpreted by voxeo TTS are okay. Otherwise, there is a tweak work, like manually using <break> or using comma to break the sentence into a few words together so as to make the speech more natural. This could be a problem if the text is instantly interpreted to a speech on the fly as soon as TTS engine receives text from a Web application. Voxeo claims that the speech will be better with their pay voice version. In addition, some words from voxeo TTS are never right to my ears. For example, slash or the punctuation / is always pronounced as flash. The word project sometimes is read as pro-jack or pro-ject. |
Voice Recognition | Acceptable. | Frustrated. You'd better code with DTMF (telephone keybad input). I am not sure if voxeo's voice recognition engine is coded with genetic algorithm so that it could learn in the long run. |
HTTP Integration | As of my writing now, I still don't know where/what the actual voice URL of BeVocal is. Thus, I cannot forward the application control (using <goto>) back to the particular dialog of the vxml on BeVocal server. I need to duplicate all the scripts on my Web Server in order to continue the application. BeVocal probably has published the HTTP connection information somewhere in their site. However, for this moment, I just want to test and see how my Web application works with voice dialogs. When you're serving your vxml via HTTP to BeVocal voice server, your vxml file must set CONTENT-TYPE header to application/voicexml+xml. Otherwise, an error is expected. |
I like voxeo approach using Web URL as their voice browser URL. It is a lot simpler for a beginner like me. The concept is very simple and easy to implement. With Web URL approach, I can simply use <goto> fetch my vxml files or return to any <form> of the same vxml file. There is no file duplicate needed on my Web server. And I don't need to research how to do HTTP Integration either at my early learning stage. Voxeo will process your vxml with CONTENT-TYPE header set to either text/html or application/voicexml+xml. |
Grammar and Syntax |
It is hard to say which one will be easy to work with.
I cannot tell which one is more straight on the W3C spec either.
They are slightly different. For example, For BeVocal, we must have this; otherwise, it will be error out. <vxml version="2.1" xmln="http://www.w3.org/2001/vxml"> For Voxeo, we can have: <vxml version="2.1"> or <vxml version="2.1" xmln="http://www.w3.org/2001/vxml"> For BeVocal, it accepts the following and your script runs without any problem: <form id="q"> <block> <subdialog name="result" src="#personalInfo"> <filled> ... </filled> </subdialog> </block> </form>For Voxeo, your scripts will never be run but it won't generate an error for you that makes debugging very difficult. I have left a note to their support team and hope that they will speak to their engineers about this. To work around this, it is better to follow the W3C specification 100%. If something goes wrong, check the spec first. |
|
How Easy to Test an Application? |
BeVocal displays 1-800 number + pin, a direct number and SIP on every Web page saying for application testing. For unknown reason, I can only use the direct number. The 1-800 number and SIP have never worked for me. | Voxeo provides 5 ways to test every application: 1-800 + pin, a direct number, Skype, FWD, SIP and even iNum number. Every method works for me like a charm. |
How Many Applications Can be Tested at a Time? |
One. BeVocal only allows you activating an application for test at a time. | Many. Each application will be assigned to different numbers and pin. |
Application Debugging | BeVocal's Log Browser can be used as a tool to debug your vxml but you cannot view that particular log while you're executing the application. Each log can be reviewed after execution with color highlighting. All errors will be highlighted in red, letting you know exactly which line it is, similar to other programming debugging tool. Their Vocal Debugger will allow you walking through the script and even pause your application at certain point. The pause is not a break point unlike other programming tool where you can set it beforehand. You only set it when you run the application. If you don't like to use a phone to test your voice application, you can use their Vocal Scripter. It simulates the dialing process for connection and convert your response in text to voice back to your application. But I am not fond of it. I would like to test the voice quality as well. |
Voxeo only provides a single tool called Application Debugger. You can have it open while you are testing your application. When an error occurs, it will highlight it in red. Unfortunately, the error is not exactly what we are looking for in our script. They are mostly Java stack trace error with the line numbers that we don't care. It is good for Voxeo supports or their developers for further diagnostic. I like BeVocal giving me exactly which line of my script is having a problem. Unlike BeVocal debugger, Voxeo debugger won't allow you walking through the application directly. But it provides the execution messages as if it documents the call scenario so that you can look at the output and see if there is any abnormality. Their error logs can be retrieved in a later time but as soon as you close your debugger, all the color highlighting is gone forever. The log is in plain text. Within a day, you can easily view it with your browser. Otherwise, you have to download it first because Voxeo will put them in a .GZ file. Because of this, I guess, Voxeo provides another tool called Prophecy Log Search. Still there is no color highlighting. At this moment, I don't find it useful but instead dislike it. To me, the tool is too heavy. The search is slow. JavaScript error is everywhere. It doesn't support both IE 7 and Sea Monkey 1.1.14, which I use intensively for my Web development. |
One important thing that I learned within these two weeks is about a shadow variable. In the beginning of my learning, I was confused by this term being used in IVR. A variable is a variable. What does it mean a shadow variable? If I am correct, it is similar to a read-only property of an object. When we use one of the pre-defined tag element such as <record>, we are sure able to access its attributes. But this <record> tag consists of other properties available after the code execution like duration, size, termchar and maxtime. They are all read-only. In IVR world, such read-only properties are called shadow variables.
In closing, as a beginner, I would like to work with voxeo because their support encourages me to do more in their products, which I could not find this with other companies. Although I am frustrated by their voice recognition all the time, I found a way to work around it. Of course, I wish that voxeo could improve it in the future soon.
Sunday, June 21, 2009
Common ASP.NET problems related to IIS
OK button is grayed out while adding an IIS file mapping
Missing ASP.NET tab on IIS Manager
Parser Error: Could not load type
The page cannot be found - return 404 for ASP.NET pages
Make sure IIS is accepting the correct ASP.NET version.On Windows 2003, you also need to ensure ASP.NET version is set to Allow for that ASP.NET version in Web Service Extensions. If you don't see ASP.NET extension, follow "Missing ASP.NET tab on IIS Manager" to install and enable it. After that, if you're running into the following error, your ASP.NET page probably has to run some shell command that requires additional permission.
The compiler failed with error code 128. ... c:\windows\system32\inetsrv> "C:\WINDOWS\Microsoft.NET\Framework\v3.5\csc.exe" ...In this case, go to Administrative Tools and select Services:
- In the Services pane, locate World Wide Web Publishing Service.
- Right-click World Wide Web Publishing Service, and then click Properties.
- Click the Log On tab.
- Click to clear the Allow service to interact with desktop checkbox.
- Click OK.
OK button is grayed out while adding an IIS file mapping
It is a small bug on IIS 5.1 with Windows XP.
To work around this:
After selecting the executable via the Browse... button, click on the textbox itself and the path will then be fully expanded. It in turn enables the OK button. [ref]
Missing ASP.NET tab on IIS Manager
Please ensure you have installed .NET framework first. For ASP.NET 2.0 or later, at the command prompt, do the following to install and enable ASP.NET on IIS:- %WinDir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i -enable
Parser Error: Could not load type
You may experience the following error on IIS after you've published your ASP.NET application. But everything works fine in the Visual Studio. For example,Parser Error Message: Could not load type 'SysAdmin.RunBatch'.
- Check the Application Settings of your Web site or virtual directory, and then make sure there is Application name for it.
- On IIS, right click the Web site or virtual directory, and then select Properties.
- At Home Directory of Directory tab, click Create button to create the Application Name if it doesn't exist.
- Execute Permissions must be at least set to Scripts only.
- Click Apply and then OK to exit.
- Check and ensure that the associated bin directory is resided with your aspx pages and Web.config. It is similar to the directory structure when you developed your application.
Friday, June 19, 2009
Add a file extension mapping on IIS for ASP.NET handler
- Right click the Web site or the virtual directory and then select Properties.
- Select Configuration button on Home Directory tab (for Web site) or Directory (for virtual directory).
- On Mappings tab, click Add.
- For ASP.NET 2.0 or later,
Executable C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll Extension the file extension you want to map, e.g., .simple
Here is an example.
- Click OK, then Apply or OK.
- Exit the wizard
Thursday, June 11, 2009
VMWare: Defrag or convert your 2nd virtual hard disk
In order to defrag or convert the 2nd disk, you need to reference or create the corresponding disk descriptor file that points to your 2nd disk. A disk descriptor file is simply a plain text file with the same extension as your virtual disk (vmdk). Its file size is usually about 1 or 2 KB.
- Go VMware Server Console (VMware Server v1) or VI (VMware Server v2).
- Select the VM.
- Stop/shutdown the VM if it is running.
- Select Edit Virtual machine settings.
- Swap your 2nd disk node with the first HD node. Make sure the end result of your 2nd disk is at (0:0) node position:
- In the Hardware tab, select Hard Disk at (0:0) node if you are using VMware Server v1; or select Hard Disk 1 for VMware Server v2.
- Change it to other node. For Server v1, click Advance for selection. For Server v2, the selection should be at the right pane and named with Virtual Device Node.
- Select your 2nd hard disk and change it to (0:0) node position.
- Click OK and exit Virtual Machine Settings.
- A new disk descriptor file in plain text is produced and named under your 2nd HD name with a VMDK extension, e.g., W2008My2HD.vmdk.
- For Server v1, you can directly defrag the VM via the console. Or like v2, you can use virtual disk manager for defragmentation. With VMDK text file, you can do whatever you want with Virtual Disk Manager.
Don't forget to change it back to the original setting when you're done; otherwise, your VM won't boot.
Please remember that there is no need to use virtual disk manager to defrag a virtual machine (VM) if it is created in one big flat file or a set of preallocated 2GB files. Such a VM is only needed to defrag at the Windows level.
I would recommend to use flat or preallocated 2GB type for your 2nd, 3rd, ...and etc hard disk so that you don't have go through this hassle.
Sunday, May 31, 2009
Programmatically change Web project settings from dynamic port to static
If you have a solution consisting of many Web applications that currently use dynamic ports for debugging and now you want to modify them to be static, it will be tedious and extremely time-consuming to go in each project and change it. I developed an application to resolve this. For the future sake, I create a custom project template so that I don't have to go in the project properties and change it whenever a new Web application is created. Indeed, with my own project template, I can customize other things like libraries, references and macros I always use in a project.
Currently the application supports VS.2008. It takes the solution file (.sln) as an input to locate the project locations, and then goes in each indiviual project file (e.g., .csproj and .vbproj) to alter the setting. It only targets Web application including WCF. but not Website because the Web project properties for a Website is stored in .sln file.
The idea behind this application is very simple.- Define the settings
- Define data structure to contain the settings
- Define function to alter the settings
- Describe basic project file structure in Solution (.sln)
- Put everything together
- Request my application
Define the settings
First, I create a setting file called vs.xml. Currently the port is default to 2332. The text in light green background is similar to the text you may find in your Web project file.
<?xml version="1.0" encoding="utf-8" ?> <VisualStudio target="Visual Studio 2008 "> <SolutionFile version="10.00" desc="Microsoft Visual Studio Solution File, Format Version"> <Languages> <Langauge enabled="true"> <Type>CSharp</Type> <GUID>{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}</GUID> <extension>.csproj</extension> </Langauge> <Lanaguage enabled="true"> <Type>VisualBasic</Type> <GUID>{F184B08F-C81C-45f6-A57F-5ABD9991F28F}</GUID> <extension>.vbproj</extension> </Lanaguage> </Languages> </SolutionFile> <ProjectFile desc="Microsoft Visual Studio Project File"> <Web><!-- Begin Settings --> <ProjectExtensions> <VisualStudio> <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> <!-- Define Web Project Settings --> <WebProjectProperties> <UseIIS>False</UseIIS> <AutoAssignPort>False</AutoAssignPort> <DevelopmentServerPort>2332</DevelopmentServerPort> <DevelopmentServerVPath>/</DevelopmentServerVPath> <IISUrl> </IISUrl> <NTLMAuthentication>False</NTLMAuthentication> <UseCustomServer>False</UseCustomServer> <CustomServerUrl> </CustomServerUrl> <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> </WebProjectProperties> <!-- End of Web Project Settings --> </FlavorProperties> </VisualStudio> </ProjectExtensions> <!-- End of Settings -->
</Web> </ProjectFile> </VisualStudio>
The above vs.xml can be altered to support VS.2005. But I am going to describe the details here.
Define data structure to contain the settings
Create a data structure to contain all the Web properties; they are:
Key | Value |
---|---|
UseIIS | False |
AutoAssignPort | False |
DevelopmentServerPort | 2332 |
DevelopmentServerVPath | / |
IISUrl | |
NTLMAuthentication | False |
UseCustomServer | False |
CustomServerUrl | |
SaveServerSettingsInUserFile |
I use a Dictionary to capture this.
private Dictionary<String, String> props;When the application reads vs.xml, it will automatically load all the settings into this props Dictionary.
Function to alter the settings
The function SaveTo as shown below will update the settings into the project file based on the settings in props. Note that my current version is slightly different now.
/// <summary> /// Saves the settings to a specific file. /// The project file must have ProjectExtensions/VisualStudio/FlavorProperties/WebProjectProperties /// nodes in order to be qualified for process. /// If the required elements under WebProjectProeperties node are missing from the specific document, /// it will insert them. /// The original elments in the document under that node remain intact if they don't match. /// </summary> /// <param name="fileName">the exact full filename of the project file for save</param> public void SaveTo(String fileName) { String namespaceUri = null, prefix = null; bool hasNamespace = this.HasNamespace(fileName, out namespaceUri, out prefix); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(fileName); XPathNavigator navigator = xmlDoc.CreateNavigator(); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(navigator.NameTable); if (hasNamespace) { SetupNamespaceEnv(prefix); namespaceManager.AddNamespace(prefix, namespaceUri); } XPathNavigator result = null; if (navigator.HasChildren) result = navigator.SelectSingleNode(GetTargetNodeXPathExpression(), namespaceManager); else throw new XmlException("Invalid file format, or it is not a Web project file."); if (result == null) throw new XmlException("It is not a Web project file.");The main purpose of this function does is to update the project settings:// up to here, "result" should be at node "WebProjectProperties" Dictionary
if (hasNamespace) { this.ReverseNamespaceEnv(); } }dup = this.CloneProperties(); if (result.MoveToFirstChild()) { do { result.SetValue(dup[result.Name]); dup.Remove(result.Name); } while (result.MoveToNext()); this.changed = false; // all properties updated. if (dup.Count > 0) { // Missing properties we need to save, do INSERT to file now...; result.MoveToParent(); // position back to "WebProjectProperties" node this.AppendChild(ref result, dup); } } else { // no child found at "WebProjectProperties" node this.AppendChild(ref result, dup); // add a child nod with all the needy settings } xmlDoc.Save(fileName); // Now is time to save to disk.
- First, it locates the <WebProjectProperties> node to begin the process.
<ProjectExtensions> <VisualStudio> <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> <WebProjectProperties> ... </WebProjectProperties> </FlavorProperties> </VisualStudio> </ProjectExtensions>
- When the node is found, the function will temper the settings accordingly. All settings
are stored inside the <WebProjectProperties> node. However,
- If there is empty inside the <WebProjectProperties> node, all settings will be appended into it.
- According to props, any missing setting(s) will be added accordingly.
- Any extra settings cannot be found in props will remain intact.
Describe basic project file structure in Solution (.sln)
If you use a text editor to open .sln file and view it, you will find that each project may contain the following structure.
Project("language_GUID") = "project_name", "project_location_or_file", "project_GUID"
ProjectSection(...) = ...
...
EndProjectSection
EndProrject
A regular Windows or Web project will not contain ProjectSection.
But if a Web project is type of Website, ProjectSection is used for storing
WebsiteProperties because it doesn't own a project file.
A WCF client may use WebsiteProperties for its
ProjectDependencies. In sum, most projects only contain two lines:
The first Project line and the EndProrject line.
For example,
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyTest", "Test\MyTest.csproj", "{7C0275FE-A91D-42E9-9EF1-5CCBC9D54C3C}"
EndProrject
Put everything together
All project locations registered with the solution are relative to the solution. Thus the location Test\MyTest.csproj in the above example is a relative path to its solution. As soon as the project location is found, convert it to the absolute path and then feed it to the function SaveTo, SaveTo will update the settings automatically.
In order to accomplish this, I create a Collection to contain all the
project data found in the solution file.
private Collection<ProjectIdentifier> projectCollection;Each project data is defined in the following class:
public class ProjectIdentifier { private String langGuid = null; private String name = null; private String location = null; private String guid = null; public ProjectIdentifier(String langGuid, String name, String location, String guid) { this.langGuid = langGuid; this.name = name; this.location = location; this.guid = guid; } ... }
When everything is ready, loop through the projectCollection to update the project files:
foreach (ProjectIdentifier project in c) {
...
if (System.IO.File.Exists(project.Location)) {
try {
...
if (project.IsWebProject()) {
...
this.Backup(project.Location, this.txtTag.Text.Trim());
propsBuilder.SaveTo(project.Location);
...
}
catch (Exception ex) {
String err = String.Format("Error occurs: {0}{1}{2}",
ex.Message, Environment.NewLine, ex.StackTrace);
...
}
}
else { // file not found or is not a file.
...
}
} // foreach
Request my application
Before execution, my application will first back up the project file by default while it traverses the project folder. You can override this setting if you don't like it. The backup files can be programmatically removed in a later time when you feel comfortable with the changes. I don't know how useful for you but it certainly helps me to resolve a lot of tedious tasks. Please feel free to leave me a message via the comment box for requesting this application if you think that it will be helpful to your issue. Don't forget to leave your email for response. All application requests will NOT be left on comment.
Update August 6, 2009
On or off there are people requesting it. Here are the links where I put for storage so I am no longer to manage and distribute them myself. Please feel free to download it yourself. The code has been changed since this post.
Download: [ Source ] [ Binary ]
Note that: if you request it, then you use it as your own risk. I am not responsible for any damages that may occur.
Update July 15, 2011
Sorry, this application is no longer to download. It is hard for me to ensure
that the files are still alive.
Additional notes for exporting project template
- Template Directory Setting
- Export Template and Location
- Additional Template Folders
- Edit Template Project Description
Template Directory Setting
The default location on XP for VS.2008 for template storage is at%USERPROFILE%\My Documents\Visual Studio 2008\Templates
You can change this setting at the VS.2008 menu bar: Tools --> Options.
Export Template and Location
Create a blank project, edit it, import and reference your vital libraries. When you're done, go File menu to choose Export Template.... Follow the wizard to complete the rest.
A project template is always exported to the default output folder where you cannot change:
%USERPROFILE%\My Documents\Visual Studio 2008\My Exported Templates
The location you set at Projects and Solutions is primarily for the IDE to locate and load your custom templates.
If you accept the default setting Automatically import the template into Visual Studio when you export the template, IDE will automatically save a copy under that template folder where Projects and Solutions specifies.
Additional Template Folders
For the first time project template creation, three (3) additional folders will be automatically created for your template organization:
- Visual Basic
- Visual C#
- Visual Web Developer
I won't bother to put the template into one of those folders. You can drag the zip file into them if you want to organize it. As long as the template is under the template folder, the IDE is smart enough to loop through its sub-folders and find your template.
Edit Template Project Description
If you want to display a descriptive name on the IDE, go to the designated project templates folder and then do the editing.
In my case, it is locate at H:\dev\Visual Studio 2008\Templates\ProjectTemplates.
- Extract MyTemplate.vstemplate from the zip file and then open it for edit.
- Locate <Name> and give descriptive name, e.g., My ASP.NET Web Application in C#
<VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project"> <TemplateData> <Name>My ASP.NET Web Application in C#</Name> <Description>A C# Web Application with a specific port (.NET Framework 3.5)</Description> <ProjectType>CSharp</ProjectType> ...
- Save it and then zip it back to the original zip file.
Wednesday, May 27, 2009
Problem of copying big file within a VM from the host
Have you ever experienced the following error?
Cannot copy <file_name>: The specified network name is no longer available.
Regardless of which Microsoft Windows, this problem occurs whenever you use Bridged mode on VMware network. Everything works fine with Host-only or NAT.
On VMware Server 1, I can disable the automatic bridging and then reconfigure other virtual adapter (not vmnet1 or vmnet8) as Bridged network by binding it to a physical adapter. This problem will go away. But this technique doesn't work for VMware Server 2. Thus, the problem still remains unresolved. What I can do is to copy files within the host to the VM, instead of inside the VM and do copying.
I don't believe that this post is correct. VMnet1 is Host-only. Indeed, I am not sure how we can change the nature of vmnet1 and vmnet8 to Bridged. Since the author of that post was using Host-only on vmnet1, certainly copying big file problem would not be an issue.
The other thing I would like to mention is that any newly added virtual adapter is always Host-only if the VMware Server is running on Windows. I am not sure if it holds true for other platforms.
Monday, May 25, 2009
Bridged vs Host-only vs NAT
I have been using VMware since 2002. I mostly use it for my development testing. There was no free version from VMware at that time. Luckily I got exposed to both WorkStation and GSX at work. Now I can have my free virtual server installed at home. All my VMware servers are running on Microsoft platform. I have both VMware Server 1 and 2 running on different machines. I like VMware Server 1 more than Server 2 because of its simple interface (which is VMware Server Console), a bit light weight to me and no restart needed when a configuration is changed.
Most my friends are confused by the 3 different modes network setting: Bridged, Host-only and NAT. Like most people, they use the default setting, Bridged. In the following, I am going to briefly distinguish the difference among these 3 network modes. I would also point out some issues existing in each mode, from a user point of view. Those issues applies to the free versions both VMware Server 1 and 2 running on Microsoft Windows platforms. For detail of how these 3 modes work or are configured, please consult VMware documentation ( Server 1 [Install, Manual] | Server 2 User Guide ).
Each VMware network mode is associated with a named virtual adapter. You can add and remove any virtual adapter you want. On Windows, the newly added virtual adapter is only bound to Host-only network. It may not be the case if you are running the server on other platforms but I don't know. In addition, you can configure a custom adapter to assoicate with each physical network adapter to fit your need.
These three basic VMware network are listed as follows.
Mode | Virtual Adapter |
---|---|
Bridged : | vmnet0 this is the default. |
Host-only : | vmnet1 |
NAT : | vmnet8 |
Note that the issues listed in the following table are only applied to Microsoft Windows. I am not sure if they hold true for other platforms.
Bridged (vmnet0) |
---|
Communication and Visibility: The virtual machine (VM) acts as if a regular PC ran on the same physical network. You can go Internet and do whatever you want unless your software is hardware dependent. All VMs on vmnet0 are visible to others on the same physical network and vice versa. Performance: In my experience, the VMware Bridged network is kind of slow. On Microsoft Windows, it is much slower on a workgroup network, compared to a domain. DHCP or Additional Service: No DHCP service is provided. If you don't have a router or DHCP server running on your network, this mode may not suit for you. In this case, you should consider either Host-only or NAT network depending on if you want Internet access. Issues:
|
Host-only (vmnet1) |
Communication and Visibility:The network communication of this mode is limited between the host and the VMs on the same vmnet1 adapter. Those VMs cannot make a connection beyond the host; thus there is no internet access capability. They remain hidden behind the host. You cannot configure it to expose any VM on vmnet1 to the physical network either. Performance: The performance of Host-only (or vmnet1) is very fast. I usually use this setting for software testing especially when I don't need an Internet access. For example, I could run a database server inside a VM for a simple test. DHCP or Additional Service: This mode provides DHCP sevice. If you don't have a router or a DHCP sever running on your network, this one comes in handy. This service can be disabled. Issues:
|
NAT (vmnet8) |
Communication and Visibility: All VMs using the adapter vmnet8 form a private network with the host. They all have internet access capability, but they are not visible to others beyond the host as if they are sitting behind their own firewall with the host. You can expose the VM for a particular access by port forwarding via NAT configuration provided by the VMware network utility (in the desktop Start menu: VMware -> VMware Server -> Manage Virtual Networks). Because of its internet capability, I use it often for Web application testing and development too. Performance: To me, it is faster than Bridged and could be as fast as Host-only. DHCP or Additional Service: This mode provides DHCP sevice. If you don't have a router or a DHCP sever running on your network, this one comes in handy. This mode also provides NAT service for further network configuration. Both services can be disabled. Issues:
|
If you are only using Bridged network, I would recommend to have both VMware DHCP and NAT services disabled. They are not used by Bridged.
- Locate the service you want to disable.
- Right click to select Properties.
- From the Startup type dropdown box, select Disabled.
- Click OK button.
sc config "VMnetDHCP" start= disabled sc config "VMware NAT Service" start= disabledNote that
- start= must be in one single word.
- There must be a space between the equal sign (=) and the word disabled.
Sunday, May 24, 2009
Apache ignores DocumentRoot in VirtualHost
Lasts night I got stuck in configuring a virtual host on Apache 2.2. Regardless of which port I set (including the port 80), the Apache server ignored my DocumentRoot setting for the virtual host. Until I read this post, it reminded me to check all wildcard settings. The problem I had was slightly different from the one in the post.
In that post, the problem was from the wildcard setting on the ServerName. For me, I was missing a port number next to the wildcard when I was setting it at the VirtualHost directive for localhost. Everything works fine after the port number had been added.
Please don't make the same mistake as I did. Even you are using port 80, you should always put the port number next to it. Otherwise, your virtual DocumentRoot will NOT be recognized.
The followings are my virtual host settings in httpd-vhost.conf.
Incorrect | Correct |
---|---|
NameVirtualHost *:9090
# Missing port number to localhost or the default site
<VirtualHost *>
DocumentRoot "C:\servers\Apache Software Foundation\Apache2.2\htdocs"
ServerName localhost
</VirtualHost>
<Directory "h:/vhosts">
Order Deny,Allow
Allow from all
Options Indexes FollowSymLinks
</Directory>
<VirtualHost *:9090>
# Note: no wildcard supported in ServerName
ServerName examples.local
ErrorLog "logs/examples.local-error.log"
CustomLog "logs/examples.local-access.log" common
DocumentRoot "h:/vhosts/examples"
</virtualHost>
|
NameVirtualHost *:9090
# Port number is given to the localhost or the default site
<VirtualHost *:9090>
DocumentRoot "C:\servers\Apache Software Foundation\Apache2.2\htdocs"
ServerName localhost
</VirtualHost>
<Directory "h:/vhosts">
Order Deny,Allow
Allow from all
Options Indexes FollowSymLinks
</Directory>
<VirtualHost *:9090>
# Note: no wildcard supported in ServerName
ServerName examples.local
ErrorLog "logs/examples.local-error.log"
CustomLog "logs/examples.local-access.log" common
DocumentRoot "h:/vhosts/examples"
</virtualHost>
|
Tuesday, May 19, 2009
SOAP and REST-based WCF basic settings in Web.config
SOAP | REST |
---|---|
<system.serviceModel>
<services> <service behaviorConfiguration="ServiceBehavior"> <endpoint address="" binding="wsHttpBinding"
contract=...>... </endpoint> ... </service> </services> ... </system.serviceModel> |
<system.serviceModel>
<services> <service behaviorConfiguration="ServiceBehavior"> <endpoint address=""
binding="webHttpBinding"
contract=...>behaviorConfiguration="RESTBehavior" ... </endpoint> ... </service> </services> ... <behaviors> ...
<endpointBehaviors>
</behaviors><behavior name="RESTBehavior"> <webHttp/> ... </behavior> </endpointBehaviors> ... </system.serviceModel> |
Friday, May 15, 2009
Blogger cannot display the image
Using the images stored with blogger could be tricky. There is no doubt that the image can be displayed correctly if you use exactly the code provided by blogger.
href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0dTd1RVdaar9KTLCks9J022j3MxwYgjx7fIjXCTaj1COwHcxCAEge4DKoFhoFNuFs9mGxkc4yXFby9JiZbzIuwBFSe9Qb9vKkgqZxrUR-gZdcFhksqi4IlVW8UZylPZAcge3Dw2UlaTM/s1600-h/rat_cheese.gif">
<img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 230px; height: 320px;"
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0dTd1RVdaar9KTLCks9J022j3MxwYgjx7fIjXCTaj1COwHcxCAEge4DKoFhoFNuFs9mGxkc4yXFby9JiZbzIuwBFSe9Qb9vKkgqZxrUR-gZdcFhksqi4IlVW8UZylPZAcge3Dw2UlaTM/s320/rat_cheese.gif"
border="0" alt=""
id="BLOGGER_PHOTO_ID_5336176003028964418" />
- href uses the image in s1600-h: the image looks original or bigger.
- src uses the image in s320: the image is shrunk or smaller.
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0dTd1RVdaar9KTLCks9J022j3MxwYgjx7fIjXCTaj1COwHcxCAEge4DKoFhoFNuFs9mGxkc4yXFby9JiZbzIuwBFSe9Qb9vKkgqZxrUR-gZdcFhksqi4IlVW8UZylPZAcge3Dw2UlaTM/s320/rat_cheese.gif"
border="0" alt="Using s320"
id="BLOGGER_PHOTO_ID_5336176003028964418" />
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0dTd1RVdaar9KTLCks9J022j3MxwYgjx7fIjXCTaj1COwHcxCAEge4DKoFhoFNuFs9mGxkc4yXFby9JiZbzIuwBFSe9Qb9vKkgqZxrUR-gZdcFhksqi4IlVW8UZylPZAcge3Dw2UlaTM/s1600-h/rat_cheese.gif"
border="0" alt="Using s1600-h"
id="BLOGGER_PHOTO_ID_5336176003028964418" />
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0dTd1RVdaar9KTLCks9J022j3MxwYgjx7fIjXCTaj1COwHcxCAEge4DKoFhoFNuFs9mGxkc4yXFby9JiZbzIuwBFSe9Qb9vKkgqZxrUR-gZdcFhksqi4IlVW8UZylPZAcge3Dw2UlaTM/s1600/rat_cheese.gif"
border="0" alt="Using s1600"
id="BLOGGER_PHOTO_ID_5336176003028964418" />
Sunday, May 3, 2009
LINQ and ConnectionString
Why do I have this error "No parameterless constructor defined for this object"?
Why can't I add a database table to DBML / LINQ designer?
- Why is the dropdown box of "Choose your context object" always empty or why can't I find my context object while I am configuring LinqDataSource?
Please be sure the DLL containing the context object existed and you have a reference to it. If the LINQ class is newly created, please compile the project first before you try to configure LinqDataSource.
- Why do I have this error "No parameterless constructor defined for this object"?
If you remove the ConnectionString manually from the Connection element of the DBML source file first (use external text editor to remove it) and then set the Application Settings to False (also see How to Turn off Application Settings for LINQ), your parameterless constructor of the DataContext class (e.g., Book.designer.cs) will immediately be removed by the IDE. Then the above error will occur when you recompile and run the application.
Normally enabling Application Settings on LINQ will have the parameterless constructor generated for you automatically, as long as its ConnectionString property is not empty. Indeed, you won't be able to remove the ConnectionString property inside the IDE. But you remove it anyway outside it. When this happens, the original parameterless contructor will lose forever regardless of Application Settings. Thereafer, adding back the ConnectionString property to the file will not resolve it. And the other problem dicussed in the next question may occur.
To resolve this, you need to manually add the original parameterless constructor back.
- Why does the actual connection string (like below) suddenly appear inside the parameterless contructor of my DataContext class? For example,
public BookDataContext() :
base("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Books.mdf;Integrated Security=True;User Instance=True", mappingSource)
{
OnCreated();
}Situation 1: If you set the Application Settings to False while the ConnectionString property exists in the DBML source file, your original parameterless constructor of that DataContext class will be altered by hard-coding with the actual connection string that can be found in your .config file (e.g., web.config).
Situation 2: The application had Application Settings set to False and the correct default parameterless constructor some time ago. Later, you make a change by adding a new table to the LINQ. As soon as you drag the new table to the DBML or LINQ designer, your original, correct parameterless contructor will be altered by hard-coding with the actual connection string.
Currently, I don't know any other easy way to deal with it. If you know, please jot me a note. What I do is
- First, ensure Application Settings for LINQ is set to False.
- Then, manually alter or copy the parameterless contructor back to the original .
- Why can't I add a database table to DBML / LINQ designer?
This happens when
- your Application Settings for LINQ is set to False,
- ConnectionString element doesn't exist in the DBML source file, and
- the parameterless constructor in LINQ class is missing.
The IDE needs to know where to read the connection string in order to access the database. Please ensure you have the parameterless contructor defined correctly while remaining Application Settings for LINQ to False and the absence of ConnectionString in the DBML source file.
Sample of Parameterless Constructor in a ContextClass
- public BookDataContext() : base(global::System.Configuration.ConfigurationManager.ConnectionStrings["BookConnectionString"].ConnectionString, mappingSource) { OnCreated(); } where BookDataContext is my DataContext class, BookConnectionString is the name of the connection string found in .config file. You should change them to fit yours accordingly.
The default setting of LINQ to SQL class is always True. You can do the following to disable it.
On VS IDE
- Go and double-click to open the DBML file from Solution Explorer.
- Then open the file Properties window if it is not open. Be sure that the focus is on the DBML designer tab; otherwise, you won't see or cannot continue with the next step.
- Expand Connection and then set Application Settings to False.
Saturday, April 25, 2009
MagicJack: pros and cons
MagicJack (MJ) is a USB Internet phone device using the processor chip from Tiger Jet acting as an adapter that allows you to plug in a regular phone and then use, or directly use the provided softphone via your computer with a speaker and a microphone ready. The device is Windows compliance so there is no driver needed. Any new driver update will be automatically detected and distributed via Windows update.
I purchased it because I was suddenly required 100% travel due to the department transfer and I began disliking my new task. I was thinking to leave the company by starting my job search journey. Since I had the company cell phone, I could simply forward all my personal calls to my cell because my home phone was a basic land line without any feature. Thus, I would like to have an economic solution. MagicJack is the solution I chose. If you have stable high-speed Internet connection, the phone quality will be as good as a regular land line. MJ works like other VoIPs like Vonage but with much lower cost. You can use it wherever you are including internationally, and unlimited calls are free to made within/to the US and Canada.
I am a MagicJack user and use it every day now. I would like to share some thought and experience here. You may find them useful to decide if MagicJack is right for you.
Pros | Cons |
---|---|
Driver Needed No, MagicJack is compatible on Windows and Windows compliance. Thus, there is no driver needed. Any new driver update will be automatically detected and distributed via Windows update. Easy Installation Unlike its advertisement on TV (i.e., no installation), MagicJack requires software download and installation. You must sign-up an account as soon as you have softphone installed and then activated it before you can make a call. This is based on my experience. I have 3 laptops and 1 desktop at home; they all required manually software download and installation. Cost and Features Low cost. The first year subscription including the device itself is $39.95 + shipping and handling ($9.95 for USA user). Up to this moment I am writing (April 25, 2009), each subsequent subscription per year is only $19.95 and $59.95 for 5 years. Unlike a landline or other VoIPs, the price here is final without additional tax or subcharge. The cost includes all the needy features: unlimited local and long distance call, 411 directory assistance, voice mail, call waiting, 3-way calling, call forwarding, 911 service, and Do-Not-Disturb. Total Call Minutes No limit on total call minutes. Unlimited calls can be made within the United State and Canada. But the duration of each call is limited to 2 hours. Quality of the Call and Connectivity The service provided by MagicJack is VoIP relying on Internet connection. Thus, your Internet connection stability is the key to your call quality and connectivity. I have a stable, high-speed Internet; I found the call quality is as good as a landland. I usually talk to my family about 2 hours during weekends (but there is time limit per call; 2 hours max). Within these 2 hours, my call is never interrupted nor dropped. I am happy with the call quality and I have no problem on the call connectivity. Phone Number Like other VoIP phone service providers (e.g., Vonage), MagicJack provides you a phone number. You can choose the number that you want including the area code. | Windows Only MagicJack cannot run on any other platforms but windows only. Computer-Dependent MagicJack goes offline when your computer is off. In addition, you have to log in onto the system and let the software (i.e., softphone) load before use. MagicJack provides you a call log (via softphone) but the missing call will not be captured when the computer is off unless the person leaves you a message. Any left message will be directly delivered to your email box via a WAV file. Software-Dependent You cannot make a call if your softphone is not ready. You have to wait until your softphone is completely loaded. Seeing "Ready to Call" on the softphone doesn't mean you can make a call. You may still have to wait a few seconds. Although you are able to use a regular phone to make calls, the softphone is the actual interface sitting between your phone and the device (i.e., MagicJack). Thus, if the softphone is not running, your phone will not work, and you will never know if there is a missing call unless the person leaves you a message. Only when the softphone is up and running, all calls timestamp will be kept in your call log. Any Hardware Conflict Yes, at least I found that MagicJack is conflict with my USB TV tuner. As soon as I plug the TV tuner in, the MagicJack softphone won't work without unplugging and re-plugging. The same problem occurs when you start or reboot the system with the TV tuner and MagicJack attached. If you make a call without hearing the phone dialing after you have keyed in all the numbers, it indicates either your softphone is not ready or you have hardware conflict issue. Consume More Drive Labels MagicJack is a USB device but it consumes 2 disk/drive labels. If you have a lot of external USB drives (e.g., USB thumb drives), some of them may not be recognized because MagicJack takes their original drive labels. To resolve this, you need to specifically change the drive labels either on MagicJack itself or the USB drives via Computer Management. Configurability No, there is not much you can configure MagicJack except for the call forwarding via their Web-based interface. You cannot configure the greeting message if you don't like it (sorry, I cannot find a way to do it). And you cannot change the time zone either. Thus, the time shown on the call log doesn't reflect your actual time. I have no idea which time zone is. Customer Service Unlikely you will speak to a live person over the phone but live-chat with their technical support 24/7 or via email query. Frankly, I don't find them much helpful on the issue I had. MagicJack will provide you a contact number when you have a billing issue but you need to chat with the technical support first. The attitude of the customer representative in the billing department is horrible. The one I talked to was impatient and unpleasant. The more I spoke to her, the more I got frustratetd. See my another comment on MagicJack. Time Limit Per Call Each call is limited to 2 hours. Otherwise, the call is automatically terminated and then what you can hear is the dial tone. You can continue with your conversation by placing the call again. Other Issues
|
Updated on October 17, 2009
An additional note: since MagicJack is via VoIP protocol to send voice, your traditional fax machine may not work with VoIP line. I have recently run into this problem. For the detail of why faxing and modems don't work well over VoIP, see here.
Thursday, April 23, 2009
Limitation highlight of SQL server editions
Feature | Express | Developer or Enterprise | Workgroup or Standard |
---|---|---|---|
Is free? | Yes | No | No |
Redistributable? | Yes | No | No |
Work with Team Foundation Server? |
No | No - Developer Yes - Enterprise |
Yes |
Concurrent Connection | 5 | No Limit - subject to @@MAX_Connections |
No Limit - subject to @@MAX_Connections |
Database size | 4 GB | No Limit | No Limit |
CPU supported | 1 | Maximum OS supported |
2 - Workgroup 4 - Standard |
RAM Supported | 1 GB | Maximum OS supported | 3GB - Workgroup Maximum OS supported for Standard |
Tuesday, April 21, 2009
Batch or VBScript cannot run as scheduled task on Windows 2008/Vista, why?
The script file runs fine as a scheduled task under Windows 2003/XP but it fails on Windows 2008/Vista. If you run the script manually on the command prompt on Windows 2008/Vista, it will work perfectly without a problem. It always fails when it runs as a scheduled task regardless of logon. Task Start Failed always occurs with the default error code 2147750687.
The problem spent me almost 2 months to figure out while I was busy with something else. It happened almost 8 months ago from now when everything was being moved from Windows 2003 to Windows 2008.
The followings were the scheduled task settings on Windows 2008/Vista:
- Run under the local Administrator account
- Run whether user is logged on or not
- Run with highest privileges - actually this one shouldn't be needed since it is run under the local Administrator.
Task Scheduler 2.0 took place on Windows 2008 as well as Windows Vista. There are a lot of differences from its predecessor on Windows 2003 or Windows XP. Here is one of them. When you run your script as a scheduled task, the scheduler (2.0) will create an account impersonating as the user you configure/specify for the task. The account is always resided in or runs from %systemroot%\system32\. Therefore, if your script internally uses relative path, it is going to fail 100% because of path/file not found or permission denied. For that reason, there are two options I would suggest:
- Modify all the relative paths to be fully qualified paths or absolute paths; e.g., c:\tasks\scheduled\output.txt
- Modify the script to take the directory as an argument when you run it; e.g., c:\tasks\scheduled\taskA.vbs c:\tasks\myappPath\.
In my case, as soon as I've fixed the relative path problems, all scripts with Task Scheduler 2.0 run like a charm.
In sum, checking if the problem is related to a relative path on your mystery task may save you from a million troubles.
Monday, April 13, 2009
How to attach MDF without LDF into SQL 2005 - Part 2
In the following illustration, I will use AdventureWorks.mdf as an example.
Execute the following statement to attach your MDF on SQL Management Studio:
GO
CREATE DATABASE AdventureWorks
ON PRIMARY (FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks.mdf')
FOR ATTACH_REBUILD_LOG
GO
If everything works fine, you may get the similar message below and have your database attached after execution:
-
File activation failure. The physical file name "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_log.ldf" may be incorrect.
New log file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_log.LDF' was created.
-
File activation failure. The physical file name "C:\Users\<SomeUserName>\Documents\MyCode\Test\App_Data\AdventureWorks_log.ldf" may be incorrect.
The log cannot be rebuilt when the primary file is read-only.
Msg 1813, Level 16, State 2, Line 3
Could not open new database 'AdventureWorks'. CREATE DATABASE is aborted.
Depending on how or where you get your MDF file (because your MDF may not be detached properly), your LDF rebuilt may fail and so may your database attach command. In this case, you need to download and use the free tool SQL Server Express Utility (SSEUtil) to interact with the server and create the LDF file for you. This tool also works well with the full version of SQL Server 2005. There are two (2) big steps you need to perform in order to make your MDF finally available on SQL Management Studio.
Step 1: Use SSEUtil to attach MDF into the database server
Then at the command prompt, run sseutil's attach database command. Before doing it, please be sure to add your path to sseutil.exe. Otherwise, you need to use its absolute path name,., e.g., c:\util\sseutil.exe.
- sseutil -s .\SQLExpress -a "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks.mdf" AdverureWorks
- -s to specify the instance of SQL server.
- -a to attach the database by specifying its MDF file path name.
- The last parameter is optional. It is the name of database you want to call (e.g., AdvantureWorks).
or
You can use sseutil console to interact with the server.
- To start a sseutil console, at the command prompt, type
sseutil -c
- You will see
Console mode. Type 'help' for more information.
1> - To attach a MDF, type
!attach "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks.mdf" AdventureWorks - Type quit when you're done. This step is necessary to enable you to add the database into the sysdabases in the next step by removing the lock on file.
Step 2: Add MDF into sysdatabases
-
USE master
GO
EXEC SP_ATTACH_DB
@filename1=N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks.mdf',
@dbname=N'AdventureWorks
or
-
USE master
GO
CREATE DATABASE AdventureWorks
ON PRIMARY (FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks.mdf')
FOR ATTACH
GO