问题在IIS上的WCF服务 [英] Problem with WCF services on IIS
问题描述
您好我创建WCF服务和WebDevelopmentServer运行它。它工作正常。
比我把它移动到IIS 5.1在Windows XP SP3。它停止工作。
我有错误CityService没有定义。
这不是因为JavaScript是没有找到定义。
这个环节的工作web开发服务器和返回JavaScript code上
的http://本地主机:65424 / CityService.svc / JS
但这个环节不工作,我有的资源不能找到
的https://localhost/WebApplication1/CityService.svc/js
我不明白为什么它的工作原理开发服务器和IIS不起作用?
任何人可以帮助我吗?
我的源$ C $ c是:
C#code
[的ServiceContract(命名空间=)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)
公共类CityService
{
//添加[WebGet]属性来使用HTTP GET
[OperationContract的]
公共字符串的DoWork(字符串的cityName)
{
//添加您的操作实现在这里
返回你好+的cityName;
} //加入更多的操作这里和它们标记[OperationContract的]
}
的Javascript code:
CityService.DoWork($得到(txtCity)值,的onSuccess);
XML配置:
< system.serviceModel>
<&行为GT;
< endpointBehaviors>
<行为NAME =WebApplication1.CityServiceAspNetAjaxBehavior>
< enableWebScript />
< /行为>
< / endpointBehaviors>
< /行为>
< serviceHostingEnvironment aspNetCompatibilityEnabled =真正的>
< / serviceHostingEnvironment>
<服务和GT;
<服务名称=WebApplication1.CityService>
<端点地址=behaviorConfiguration =WebApplication1.CityServiceAspNetAjaxBehavior
绑定=的WebHttpBinding合同=WebApplication1.CityService/>
< /服务>
< /服务>
<&绑定GT;
<&的WebHttpBinding GT;
<绑定名称=webBinding>
<安全模式=运输>< /安全>
< /&结合GT;
< /&的WebHttpBinding GT;
< /绑定>
Hi I created WCF service and run it on WebDevelopmentServer. It works fine.
Than I moved it to IIS 5.1 on Windows XP SP3. And it stop working. I have error "CityService is not defined". It's not defined because of javascript is not found. on webdevelopment server this link is working and returns javascript code http://localhost:65424/CityService.svc/js
but this link is not working, I have "The resource cannot be found" https://localhost/WebApplication1/CityService.svc/js
I can't understand why it works on development server and does not work on IIS?
can anybody help me please?
My source code are:
C# code
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class CityService
{
// Add [WebGet] attribute to use HTTP GET
[OperationContract]
public string DoWork(string cityName)
{
// Add your operation implementation here
return "Hello " + cityName;
}
// Add more operations here and mark them with [OperationContract]
}
Javascript code:
CityService.DoWork($get("txtCity").value, onSuccess);
Xml configuration:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="WebApplication1.CityServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" >
</serviceHostingEnvironment>
<services>
<service name="WebApplication1.CityService">
<endpoint address="" behaviorConfiguration="WebApplication1.CityServiceAspNetAjaxBehavior"
binding="webHttpBinding" contract="WebApplication1.CityService" />
</service>
</services>
<bindings>
<webHttpBinding >
<binding name="webBinding">
<security mode="Transport"></security>
</binding>
</webHttpBinding>
</bindings>
这篇关于问题在IIS上的WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!