Blog from Saravanan Arumugam

Let us talk about Technologies

Category Archives: Visual Studio

Folders created in solution not being deployed


I had some custom folders I created in my MVC3 application, such as Attachments, Forms etc. which I would use from code. For example, one of my web page would receive file attachments (Files being uploaded from the client side) from the user and store it in Attachments folder in the solution.

When I deployed my application, the these folders I didn’t show up on the Web Server.

Solution

Then I realized that the visual studio while deployment would not deploy any empty folder. Rather, it deploys files; if the file requires a new folder to be created it would create the folder.

So I created a simple text file in each of these custom folders, say AboutTheFolder.txt. This file ensured that the file gets created after creating the folders I was looking for.

Use IIS Express option doesn’t appear on the context menu of a Web based Project


I wanted to use IIS express as the development server instead of Visual studio’s built in Development Server. For that I had to install Visual Studio 2010 SP1 and IIS 7.5 Express.

However in Visual Studio, I couldn’t fine the option “Use IIS Express” when I right click on the web project.

 

Solution

As an alternate to selecting Use IIS Express, right click on the project select Properties. In the property page select the Web Tab. Here, select Use Local IIS Web Server.

Make sure that Use IIS Express is checked.

image

This will ensure that the web application is starting in IIS Express.

Unrecognized element ‘wsDualHttpBinding’ in service reference configuration. Note that only a subset of the Windows Communication Foundation configuration functionality is available in Silverlight.


This is an extension to my previous post ServiceReference.ClientConfig is not populated with Service Reference

When I created a proxy and config file by using SvcUtil.exe, I had to copy the app.config content into ServiceReference.ClientConfig.

Note: Instead of creating app.config and copying it into ServiceReference.ClientConfig, I could have used /config:ServiceReference.ClientConfig switch directly in the SvcUtil.

The build was successful but while accessing the service, I got the following runtime exception.

Exception:

Unrecognized element ‘wsDualHttpBinding’ in service reference configuration. Note that only a subset of the Windows Communication Foundation configuration functionality is available in Silverlight.

 

Solution:

The solution was simple. Change the binding to basicHttpBinding, pollingDuplexHttpBinding or customBinding.

ServiceReference.ClientConfig is not populated with Service Reference


Exception:

I came across a strange behavior of Visual Studio. When I made a Service reference in my Silverlight application, the visual studio created the classes and schemas; but not the config file (ServiceReference.ClientConfig)

 

Solution:

The reasons for having ServiceReference.ClientConfig not populated could be many. But in my case, I was using wsDualHttpBinding in the service (a duplex channeled service).

wsDualHttpBinding and may other bindings are not supported by Silverlight. To be precise Silverlight supports only BasicHttpBinding, pollingDuplexHttpBinding (supported with Silverlight 4) and customBinding.

When I made some changes in the service and changed the binding as basicHttpBinding, the Service Reference update populated the ServiceReference.ClientConfig file.

It could have been better if the service reference threw exception saying that the Silverlight supports only a subset of WCF bindings, instead of completing the reference successfully leaving the Config file incomplete. Hopefully the future releases of Visual studio would do that.

 

The following forum helped me narrow the issue.

Failed to generate the service reference WCF service

Generate asynchronous operations is checked and disabled in Service Reference Dialog


I have observed that from a sliver light client, Visual studio doesn’t allow creation of Synchronous WCF services.

When I tried to use the service reference dialog from a Silver light client, I was shown the following

image

Here we can see Generate asynchronous operations is grayed out and always checked.

This appeared to be that Visual Studio always recommends the use of Asynchronous operations.

I further tried by creating the synchronous operations through SvcUtil.exe

C:\Users\Saravanan\Projects>svcutil http://localhost:54927/GreetingService.svc?
wsdl /out:GreetingServiceProxy.cs /l:cs /config:app.config

 

But the runtime threw the following exception.

The contract ‘IGreetingService’ contains synchronous operations, which are not supported in Silverlight. Split the operations into "Begin" and "End" parts and set the AsyncPattern property on the OperationContractAttribute to ‘true’. Note that you do not have to make the same change on the server.

 

So it is evident that Silverlight supports only asynchronous web service calls.

Refer to How to: Access a Service from Silverlight and Why does my service reference only generate asynchronous methods? for more detail.