# .NET and More > Silverlight >  [RESOLVED] Deploy to webserver

## arkiboys

Hi,
this is the structure I have: 
The development is done on my machine as follows:
using VS2010, silverlight 4
1- Silverlight application is created as a project
2- silverlight app has service references to the wcf project
3- web project is a simple project which has the clientbin folder and a default.aspx page
When running the .sln on my machine, all works fine.
I have copied the entire folders for both my wcf and web projects from my local machine into the c:\inetpub\wwwroot of the webserver (Windows server 2003).
on the web server, created two virtual directories. One for the web and one for the wcf project. each points to the appropriate folder under c:\inetpub\wwwroot
I made sure the endpoints in the file Servicereferences.ClientConfig under the wcf project in the webserver is pointing to the webservername:80 
The webserver does have the correct mime file type i.e. .xap
I have also added the domain policy files onto webserver machine's C:/inetpub/wwwwroot/
In IIS, under the web project virtual directory, when I right click, browse, then it says "Page can not be found"
What have I done wrong please?
Thanks

----------


## MattP

A guess would be that IIS isn't set up to handle Silverlight MIME types.

Configuring a Web Server to Host Silverlight Content

----------


## arkiboys

Thanks for the link BUT I alerady have these files as mime types.
I wonder if this error could be to do with running .net 4 application in windows server 2003  ?
Thanks

----------


## gep13

Silly question, but let's just rule it out....

Do you have .Net Framework 4.0 installed on the server?

Gary

----------


## arkiboys

Hi,
I can now browse to the site but it only shows pages with empty controls. This
Tells me that maybe the wcf part does not get data. How do I solve this? 
 Thanks

----------


## gep13

Hey,

What did you have to do to get to this point?

Have you tried running Fiddler while accessing your page?  Are there any errors?

Have you tried using the WcfTestClient to connect to the endpoint, and execute the methods on there?

Gary

----------


## arkiboys

I changed the service extensions in IIS in webserver to allow asp.net 4
Now when browse to the server i.e.
http://webserverfullname/sitename/defaultpage.aspx  it shows the page but with no data in it
Not sure how to soove this now.
Any thoughts?
Thanks

----------


## gep13

Hey,

Did you try what I suggested?  Use the WcfTestClient to connect to the WCF Endpoint, and execute one of the methods that you are using.  Make sure that the data is coming through.

Gary

----------


## arkiboys

by wcftestClient, do you mean to create a windows app which calls the wcf?

----------


## gep13

No, that would be too much like hard work  :Smilie: 

There is a built in WCF Test Client that you can use.  You should be able to find it here:



```
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\WcfTestClient.exe
```

If it isn't in there, if you do a search for WcfTestClient, you should be able to find it.

Gary

----------


## arkiboys

By the way, I am running vs2010 silverlight 4
Shall I still go ahead with the wcftestclient path you suggested?

----------


## gep13

Hey,

I think it is still worth it yes.  You need to figure out where the problem lies, and testing the WCF End Point directly means that you can rule that out, and from there you need to look at the Silverlight application.

Gary

----------


## arkiboys

> No, that would be too much like hard work 
> 
> There is a built in WCF Test Client that you can use.  You should be able to find it here:
> 
> 
> 
> ```
> C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\WcfTestClient.exe
> ```
> ...


I found the .exe under vs 10
I am trying to add service. It says please enter the endpoint address.
What do I  enter in there exactly?

The endpoint I know of is the one in servicesreferences.clientconfig file in the silverlight application project
i.e.
<endpoint address="http://webserverfullname:80/DM.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDM"
                contract="FMService.IDM" name="BasicHttpBinding_IDM" />

----------


## gep13

Hey,

Enter this:



```
http://webserverfullname:80/DM.svc
```

Gary

----------


## arkiboys

When pointing to a service on my local machine it works fine
BUT pointing to the webserver service shows the following message:

Error: Cannot obtain Metadata from http://webserverfullname/DM.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?Link...55.WS-Metadata Exchange Error    URI: http://webserverfullname/DM.svc Metadata contains a reference that cannot be resolved: 'http://webserverfullname/DM.svc'.    There was no endpoint listening at http://webserverfullname/DM.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.    The remote server returned an error: (404) Not Found.HTTP GET Error    URI: http://webserverfullname/DM.svc    There was an error downloading 'http://webserverfullname/DM.svc'.    The request failed with HTTP status 404: Not Found.

----------


## arkiboys

> Hey,
> 
> Enter this:
> 
> 
> 
> ```
> http://webserverfullname:80/DM.svc
> ```
> ...


I was not using the correct path.
But now the error is:
The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

----------


## arkiboys

Using the testclient tool you suggested, I can access one of the methods inside the service as it calls an xml file to get data from inside the xml file.
But the errors are caused from the methods that connect to the sql server.
Could that be the reason? how can I find the exact issue?
Thanks

----------


## arkiboys

Hi gary,
Looking at logs, it says login failed for user 'domain\webserverfullname$'
Note that the connectionstring in the webconfig uses windows integrated security
Any t houghts on how to solve this please?
Thanks

----------


## gep13

Hey,

I think this is a good candidate for the problem yes.

Have you updated the connection string to point to the correct SQL server for this installation?

What exactly is the error?

Gary

----------


## gep13

> Hi gary,
> Looking at logs, it says login failed for user 'domain\webserverfullname$'
> Note that the connectionstring in the webconfig uses windows integrated security
> Any t houghts on how to solve this please?
> Thanks


This would suggest that the current user doesn't have access to the database.  Have you verified that they do have access?  Is this a database server that you have full control over?

Gary

----------


## arkiboys

Gary,
I have just been told that we can only access the sql server using the integrated security as the sql authentication is disabled.
May be to solve this problem I can make the wcf which is now hosted on the webserver to run under the account that the site is logging in as ?
May be I should check the settings on the virtual directory of the wcf ?

The message is:
22/12/2010 10:27:42 - Connection --> Data Source=sqlservermachinename;Initial Catalog=my database;Integrated Security=true
22/12/2010 10:27:42 - --------------
22/12/2010 10:27:42 - System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'domain\webserverfullname$'.

----------


## gep13

Yip, that sounds like a plan.

Gary

----------


## arkiboys

How do i make the wcf service (Which is hosted in the webserver) to run under a specific account?
At present it as enable anonymous access checked as well as integrated windows authentication.
Thanks

----------


## gep13

Hey,

You can change the identity of the Application Pool that is hosting the WCF Endpoint.

Gary

----------


## arkiboys

Now the error is:

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

Server stack trace: 
   at System.ServiceModel.Channels.HttpInput.ThrowMaxReceivedMessageSizeExceeded()
   at System.ServiceModel.Channels.HttpInput.GetMessageBuffer()
   at System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream)
   at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception& requestException)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(T  imeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at IDM.GetAllNames()
   at DMClient.GetAllNames()

Inner Exception:
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

----------


## gep13

Hey,

This suggests that the data being returned is too much for the WCF Contract that has been created.  If you look in the config file for the WCF EndPoint, as well as your client, you should find the value of 65536.  If you increase this to a higher number, it should start to work.

Gary

----------


## arkiboys

The data returned is only 1300.
i think you are referring to the config file of the wcftest tool you pointed me to, right?

----------


## gep13

The MaxReceivedMessageSize can be specified on both the client and the server, i.e. the maximum amount that can be sent, and that can be received, so you have to set it on both sides.  I typically make these the same value.

Gary

----------


## arkiboys

On the server, you mean the wcf project ?
On the client, you mean the servicereferences.clientconfig in the silverlight application project?

----------


## gep13

Correct.

Or in the case of the WcfTestClient, it's config file, as you mentioned before.

However, now that you have the WcfTestClient returning this error, have you tried the Silverlight application again?

Gary

----------

