Page view counter
HowTo publish Silverlight website (with web service) from VisStudio to remote server?
Last post 07-23-2008 6:05 PM by TBink. 5 replies.
Sort Posts:
07-21-2008 5:39 PM
HowTo publish Silverlight website (with web service) from VisStudio to remote server?

This will no doubt be a dumb question... but, could anyone give me a 1, 2, 3... of how to install my Silverlight website (with web services) to a remote server?

Here's what I have built so far.

1) within Visual Studio I built a Silverlight application + website Solution (from the preset)

2) added a web service "myservice.asmx.cs" to the App_Code directory of the website

3) everything works solidly running from within VisStudio using the VS 'development server

NOW... how can I (as easily as possible) install what I have working within Visual Studio to a remote webserver?  This part is all new to me and I'm afraid I can be a little dense so a "for dummies" approach would be appreciated Tongue Tied

TBink

Loading...
Joined on 05-01-2007
Posts 171
07-22-2008 12:43 AM
Re: HowTo publish Silverlight website (with web service) from VisStudio to remote server?

Well, I personally think it is a good practice to publish the WebService first if it is not on the Remote Server 

  1. RightClicking on the Service Project
  2. and click publish then just type the address and that should work

Here, after you have published your Service, you should edit the Service Reference in your ASP.net WebSite. Edit the Service and type in the address of the published Service. Check if the clientaccesspolicy.xml is accessible in the root of the Service.

Then, it is the part of publishing the WebSite, since you have edited the Service Reference there, check if the ServiceReferences.ClientConfig has included the correct endpoint address or not. If yes, you can do the things similar to what you did with the Service

  1. Right Clicking on the ASP.NET WebSite Project
  2. choose Publish WebSite
  3. type the address and done

Regards,
SteveWong (HongKong)
Please mark post as answer if they help you

TestPage

SteveWong

Loading...
Joined on 03-27-2008
Hong Kong
Posts 1,104
07-22-2008 5:23 PM
Re: HowTo publish Silverlight website (with web service) from VisStudio to remote server?

Thank you.  That answers most of my question.  I got everything working in a test.  But I now want to do this...

  1. I have an installed web service on my a remote server:  address:   /silverlight/webservice/MyWebService.asmx
  2. I have my Silverlight web site on the same server, same base directory:  address:   /silverlight/TestService (TestRemoteWebServiceTestPage.html)
  3. My embedded silverlight project is configured to so that the service reference address is:  http://www.mydummyaddress.com/silverlight/webservice/streamashwebservice.asmx
  4. When installed on the web server everything runs fine
  5. HOWEVER, I also want to be able to use that remote service from within my VS2008 solution, but I get an error when I do (the async callback fails)
    1. I'm guessing this has to do with the web.config file... in the VS2008 website directory.  It looks like this:

 Is it a problem with this setting??   allowDefinition="MachineToApplication"

So, again, my Question.
How can I consume my remote server based web service from within my Silverlight website running in VS2008?

My installed web service (#1 above) has a web.config that reads.  Should it be changed?

---------------- the web.config installed with the web service on the remote server -------------

?xml version="1.0"?><configuration>

 

<appSettings/>

<connectionStrings/>

 

<
system.web><!--

Set compilation debug="true" to insert debugging

symbols into the compiled page. Because this

affects performance, set this value to true only

during development.

-->

<compilation debug="true" />

<!--

The <authentication> section enables configuration

of the security authentication mode used by

ASP.NET to identify an incoming user.

-->

<authentication mode="Windows" />

<!--

The <customErrors> section enables configuration

of what to do if/when an unhandled error occurs

during the execution of a request. Specifically,

it enables developers to configure html error pages

to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

<error statusCode="403" redirect="NoAccess.htm" />

<error statusCode="404" redirect="FileNotFound.htm" />

</customErrors>

-->

</system.web>

</configuration>

----------------------------------------------------------------  This is the web.config that is present in my VS2008 silverlight website --------------------------

<?xml version="1.0"?>

<!--

Note: As an alternative to hand editing this file you can use the

web admin tool to configure settings for your application. Use

the Website->Asp.Net Configuration option in Visual Studio.

A full list of settings and comments can be found in

machine.config.comments usually located in

\Windows\Microsoft.Net\Framework\v2.x\Config

-->

<
configuration>

<configSections>

<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>

<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

</sectionGroup>

</sectionGroup>

</sectionGroup>

</configSections>

<appSettings/>

<connectionStrings/>

<system.web><!--

Set compilation debug="true" to insert debugging

symbols into the compiled page. Because this

affects performance, set this value to true only

during development.

-->

<compilation debug="true">

<assemblies>

<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

</assemblies>

</compilation>

<!--

The <authentication> section enables configuration

of the security authentication mode used by

ASP.NET to identify an incoming user.

-->

<authentication mode="Windows"/>

<!--

The <customErrors> section enables configuration

of what to do if/when an unhandled error occurs

during the execution of a request. Specifically,

it enables developers to configure html error pages

to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

<error statusCode="403" redirect="NoAccess.htm" />

<error statusCode="404" redirect="FileNotFound.htm" />

</customErrors>

-->

<pages>

<controls>

<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

</controls>

</pages>

<httpHandlers>

<remove verb="*" path="*.asmx"/>

<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>

</httpHandlers>

<httpModules>

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

</httpModules>

</system.web>

<system.codedom>

<compilers>

<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

<providerOption name="CompilerVersion" value="v3.5"/>

<providerOption name="WarnAsError" value="false"/>

</compiler>

<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

<providerOption name="CompilerVersion" value="v3.5"/>

<providerOption name="OptionInfer" value="true"/>

<providerOption name="WarnAsError" value="false"/>

</compiler>

</compilers>

</system.codedom>

<!--

The system.webServer section is required for running ASP.NET AJAX under Internet

Information Services 7.0. It is not necessary for previous version of IIS.

-->

<system.webServer>

<validation validateIntegratedModeConfiguration="false"/>

<modules>

<remove name="ScriptModule"/>

<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

</modules>

<handlers>

<remove name="WebServiceHandlerFactory-Integrated"/>

<remove name="ScriptHandlerFactory"/>

<remove name="ScriptHandlerFactoryAppServices"/>

<remove name="ScriptResource"/>

<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

</handlers>

</system.webServer>

<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

<dependentAssembly>

<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>

<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>

</dependentAssembly>

<dependentAssembly>

<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>

<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>

</dependentAssembly>

</assemblyBinding>

</runtime>

</configuration>

TBink

Loading...
Joined on 05-01-2007
Posts 171
07-22-2008 11:11 PM
Re: Re: HowTo publish Silverlight website (with web service) from VisStudio to remote server?

[duplicated post] Sorry

Regards,
SteveWong (HongKong)
Please mark post as answer if they help you

TestPage

SteveWong

Loading...
Joined on 03-27-2008
Hong Kong
Posts 1,104
07-22-2008 11:11 PM
Re: Re: HowTo publish Silverlight website (with web service) from VisStudio to remote server?

If the remote Server is accessible, what you have to do differently is to type the remote server Service address rather than the local one.

In another way, if the remote Server Service is a kind of search engine like the seeqpod.com. You can create a local Service to help you to handle the communication between the remote service which only return XMLString. The local Service then pass it back to Silverlight to show on the screen in different way.

Regards,
SteveWong (HongKong)
Please mark post as answer if they help you

TestPage

SteveWong

Loading...
Joined on 03-27-2008
Hong Kong
Posts 1,104
07-23-2008 6:05 PM
Marked as Answer
Re: Re: Re: HowTo publish Silverlight website (with web service) from VisStudio to remote server?

the problem was solved finally by a change in clientaccesspolicy.xml

 this line was added

<allow-from http-request-headers="*">

TBink

Loading...
Joined on 05-01-2007
Posts 171
Microsoft Communities