简体   繁体   English

在IIS上托管WCF后出现“请求错误”

[英]Getting “Request Error” after hosting WCF on IIS

Before hosting WCF Restful Services on IIS. 在IIS上托管WCF Restful Services之前。 I was getting response from server in my android application but now I have hosted my services on IIS but getting an error message of REQUEST ERROR . 我正在从Android应用程序中的服务器获得响应,但是现在我将服务托管在IIS上,但收到一条错误消息REQUEST ERROR I don't know what's went wrong. 我不知道出了什么问题。 can someone please sort out my problem. 有人可以解决我的问题吗? Thanks in Advance 提前致谢

Before Hosting on IIS 在IIS上托管之前

在此处输入图片说明

the above picture is before hosting the service on IIS. 上面的图片是在IIS上托管服务之前的。 and the yellow highlighted text is param and the JSON is the response which is corresponding to that param . 黄色高亮显示的文本是param ,JSON是对应于该param的响应。

After Hosting on IIS 在IIS上托管之后

在此处输入图片说明

I don't know why I'm getting this error. 我不知道为什么会收到此错误。 what went wrong and how to fix that. 出了什么问题以及如何解决。 now im trying to retrieving data correspond to that param but getting an error message. 现在,我正在尝试检索与该param对应的数据,但收到错误消息。

"SERVER LOG after includeexceptiondetailInfaults attribute value to true" includeexceptiondetailInfaults属性值设置为true后的服务器日志”

I'ms sure that database is causing the error and you can view the picture of server log below 我确定数据库是导致错误的原因,您可以在下面查看server log的图片

在此处输入图片说明

The database was causing an error. 数据库导致错误。 I have found the solution. 我找到了解决方案。 what we need to do? 我们需要做什么? We need to add a login to SQL Server for IIS APPPOOL\\ASP.NET v4.0 and grant permissions to the database. 我们需要为IIS APPPOOL\\ASP.NET v4.0SQL Server添加一个登录名,并向数据库授予权限。

In SQL Server Management, under the server, expand Security, then right click the Logins and select "New Login...". 在“ SQL Server管理”中,在服务器下,展开“安全性”,然后右键单击“登录名”并选择“新登录名...”。

In the New Login dialog, enter the app pool as the login name and click "OK" 在“新建登录名”对话框中,输入应用程序池作为登录名,然后单击“确定”。

在此处输入图片说明 now right click the login, select properties and then click on the User Mapping Option. 现在,右键单击登录名,选择属性,然后单击“用户映射选项”。 Click the appropriate DATABASE and check the properties roles. 单击适当的数据库,然后检查属性角色。 And we are done :). 至此,我们完成了:)。

hope you good luck. 希望你好运。 Thanks 谢谢

Possible solutions would be, 可能的解决方案是

(i)Just ensure all your property are public. (i)只需确保您的所有财产都是公开的即可。

(ii)To So see more details about the issue, you need to includeexceptiondetailInfaults attribute to true in servicedebug tag. (ii)要查看有关此问题的更多详细信息,您需要在servicedebug标记中将exceptiondetailInfaults属性包含为true。

<servicebehaviors>
        <behavior name="myServiceBehavior">
          <servicedebug includeexceptiondetailinfaults="true" />
        </behavior>
</servicebehaviors>

(iii)Remove the Enum types (or use their suggested work-around and use a wrapper around the enum properties) and this should go away. (iii)删除Enum类型(或使用其建议的解决方法,并在enum属性周围使用包装器),这应该消失了。

(iv)Copy the connection strings from the class library app.config to the web project web.config If you are using a class library and a web project, (iv)将连接字符串从类库app.config复制到Web项目web.config中。如果您使用的是类库和Web项目,

After hosting on iis Request error occurred in iis The server encountered on request error see server logs for more details Solution In your sql server change window authentic to sql authentic with username and password 在iis上托管后,在iis中发生请求错误在请求中遇到服务器错误,请参阅服务器日志以获取更多详细信息解决方案在sql服务器中,将用户名和密码从“ authenticate”更改为sql authenticate
and change on connection string After changing these step and refresh the iis and Your problem is solved 并更改连接字符串更改这些步骤并刷新iis之后,您的问题已解决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM