需要在system.web中加入以下代码。
<webServices>
<protocols>
<add name="HttpSoap"/>
<add name="HttpPost"/>
<add name="HttpGet"/>
<add name="Documentation"/>
</protocols>
</webServices>
如果WindowsIdentity.GetCurrent().Name还是Get不到当前电脑的用户名,需要在iis中配置。
双击站点,在右边IIS中找到Authenticcation图标,点进去
Anonymous Authentica 设置为Disabled,
ASP.NET Impersonation设置为 Enabled,
Basic Authentication设置为Disabled,
Forms Authentication 设置为Disabled,
Windows Authentication设置为Enabled。
原文:https://www.cnblogs.com/zhangbupangpang/p/14870473.html
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!