Silverlight 部署到IIS的问题,请教。

star250 2009-04-15 05:14:37
我在微软下载了demo,在vs2008里调试成功,使用正常。

但是部署到IIS就有问题。首页可以打开,但是提示系统错误,好像是Account方面的问题。
是不是我的XP的IIS 5.1 不能支持?
不知道哪里的问题?请帮帮忙



如果你有空,可以下载试试,也是很好的demo
http://code.msdn.microsoft.com/PRCSL2Samples/Release/ProjectReleases.aspx?ReleaseId=1985


...全文
1376 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
bing1051 2011-02-22
  • 打赏
  • 举报
回复
我也遇到一堆的问题 还没有解决
fanshengrui 2010-01-10
  • 打赏
  • 举报
回复
可以教我如何发布文件吗?我的状况和你一样,在局域网中知我自己可以访问网站,其他的访问数据库都报错
star250 2009-04-17
  • 打赏
  • 举报
回复
我在web.config中加入如下配置节内容
<webServices>
<protocols>
<add name="HttpSoap"/>
<add name="HttpPost"/>
<add name="HttpGet"/>
<add name="Documentation"/>
</protocols>
</webServices>

现在局域网的计算机可以通过:http://192.168.1.101/SilverlightApplication2/BlogService.asmx
访问到服务了。网页还是有问题。
star250 2009-04-17
  • 打赏
  • 举报
回复
我做了一个demo测试 WebService功能。
果然有问题,我使用了clientaccesspolicy.xml 放入wwwroot文件夹下,和项目里,编译。
修改ServiceReferences.ClientConfig 中的
<endpoint address="http://localhost:3333/SilverlightApplication2/BlogService.asmx" binding="basicHttpBinding"
bindingConfiguration="BlogServiceSoap" contract="BlogService.BlogServiceSoap"
name="BlogServiceSoap" />
改为:
<endpoint address="http://localhost/SilverlightApplication2/BlogService.asmx" binding="basicHttpBinding"
bindingConfiguration="BlogServiceSoap" contract="BlogService.BlogServiceSoap"
name="BlogServiceSoap" />

这样调试成功,IIS部署也ok了。

依照这个办法,用在我的项目中。还有不行,于是,我修改了数据库链接,使用我创建的数据库账户,去掉windows安全登陆方式。这样IIS部署就访问正常了。
但是,我在局域网的其他机器上不能正常访问,可能还是跨域的问题。
再想想看,谢谢你的帮助。
Silverlight 真是难搞啊,这问题我搞了很久了。
star250 2009-04-17
  • 打赏
  • 举报
回复
我添加了crossdomain.xml和clientaccesspolicy.xml 这两个文件。
并且修改了ServiceReferences.ClientConfig 中的
<endpoint address="http://localhost:3333/SilverlightApplication2/BlogService.asmx" binding="basicHttpBinding"
bindingConfiguration="BlogServiceSoap" contract="BlogService.BlogServiceSoap"
name="BlogServiceSoap" />
地址为我部署的域名。
终于搞定了。
汗啊,部署问题困扰了我好几天。谢谢你的帮助。
longhui666888 2009-04-17
  • 打赏
  • 举报
回复
我的跨域问题解决了。在承载服务的网站根目录下放两个文件。
http://msdn.microsoft.com/zh-cn/library/cc197955(VS.95).aspx
参照这篇文章设置。
还有就是,我用的是SVC服务,ASMX服务没有测试
star250 2009-04-16
  • 打赏
  • 举报
回复
以下是安装版的安装说明,请帮忙看看有什么重点要注意的

Install requirement:
1, .NET Framework 3.5 and IIS, if you are running IIS7 on Vista/Windows Server 2008, please make sure that you installed 'IIS Metabase and IIS 6 configuration compatibility' component (Start->Control Panel->Programs->Turn Windows features on or off->Internet Information Services->Web Management Tools->IIS 6 Management Compatibility). If this component is not installed on your machine, the installation may exit or throw out an error like '0x80005000'. And please also make sure that you enable 'ASP.NET' on your IIS when you are working with Vista/Windows Server 2008. For example, if you see '0x80070021' when you run the sample, it means your ASP.NET has not been enabled. If you see 'Can not connect the server' when you launch the website, it indicates that your ASP.NET has not been registered to IIS. Please uninstall your .NET Framework and then reinstall to try again.

2, SQL Server 2005 Express with 'sqlcmd.exe' which is also installed by default.
If any of above components is not on your machine, the installation may exit or throw out an error like '0x80005000'.

3, Configuration issues when deploying on Microsoft IIS. Add the MIME type for the .xap extension to application/x-silverlight-app in 'IIS MIME type dialog' if necessary. Otherwise the clients might receive a 404 HTTP error and cannot download ClientBin/en-US/PhotoBlog.xap.


Notice:
1, The setup program prompts you input a deployment domain which might be IP address or machine name. The users can browse the website via 'http://domain/PhotoBlogWeb/PhotoBlog.aspx' where 'domain' is the deployment domain you input in setup process.

2, The install program grants the access privilege of the program folder to the OS user named "ASPNET" or the OS group named "IIS_WPG".
longhui666888 2009-04-16
  • 打赏
  • 举报
回复
我也遇到了这个问题
silverlight通过SVC,ASMX获取数据都一样。
在VS里F5运行没问题,部署到IIS里就报错
longhui666888 2009-04-16
  • 打赏
  • 举报
回复
如果你的www.star250.com上已部署好服务,重新引用是最省事.
看这个错误提示,估计你是在本机上调试了.
解决方法一,在网上查找资料,解决这个跨域的问题.(我查了,但是没成功,嘿嘿)
解决方法二,直接发布到www.star250.com上去看效果.

对于方法二,可以不必真的发到远程服务器上,只要在自己的机器上或局域网的机器上配好IIS,加上www.star250.com的主机头.
修改本机上的HOST文件,让www.star250.com指向刚配置的机器上.以达到欺骗机器的目的.
这样可以发布网站到本地的IIS上进行调试,又不会因为上传文件花费太多时间.
star250 2009-04-16
  • 打赏
  • 举报
回复
我把所以的webService 地址改为我的域名了。
调试错误提示:
尝试请求 URI“http://www.star250.com/PhotoWebService.asmx”时发生错误。这可能是因为在没有适当的跨域策略的情况下试图以跨域方式访问服务,或者是策略不适用于 SOAP 服务。您可能需要与服务所有者联系以发布跨域策略文件,确保策略允许发送与 SOAP 相关的 HTTP 头。请参阅内部异常以了解详细信息。


========================
star250 2009-04-16
  • 打赏
  • 举报
回复
谢谢 longhui
我发现有很多的WebService都用到具体地址
<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://localhost:30303/PhotoBlogWeb/PhotoWebService.asmx?wsdl" docRef="http://localhost:30303/PhotoBlogWeb/PhotoWebService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://localhost:30303/PhotoBlogWeb/PhotoWebService.asmx" xmlns:q1="http://tempuri.org/" binding="q1:PhotoServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://localhost:30303/PhotoBlogWeb/PhotoWebService.asmx" xmlns:q2="http://tempuri.org/" binding="q2:PhotoServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>


我不知道该什么修改这些端口。我全部改为了http://localhost 不加端口,这样调试不能通过,应为调试时端口是30303.
难道WebService 地址要写死了?
longhui666888 2009-04-16
  • 打赏
  • 举报
回复
兄弟,不知道你的问题解决了没,我这个是解决了。
在网上查了查,大都说是跨域的问题引起的,照着说明改了一下不成。也是,服务是自己写的,属于同一个项目,也发布在同一个站上,怎么会出现跨域的问题呢?后来经过调试,原来最初是通过localhost引用的同一解决方案内的服务,虽然后来更改了引用地址,但是没有全部改过来,发布到IIS后还是去按原localhost地址去找,就出现了跨域的问题。其实这里即使没有跨域问题,也是找不到那个服务的。
解决方法就是,删掉以前的服务引用,重新按http://www.xxx.com/xxx.asmx的地址去添加引用(可以先把项目发布到IIS上,不用管silverlight能不能用,只要服务能用就成)。再把整个项目重新发布到IIS上,就OK了。

8,734

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧