internal void RegisterPrefix(string uriPrefix, int contextId)
        {
            _logger.LogDebug(LoggerEventIds.RegisteringPrefix, "Listening on prefix: {0}", uriPrefix);
            CheckDisposed();
            var statusCode = HttpApi.HttpAddUrlToUrlGroup(Id, uriPrefix, (ulong)contextId, 0);

            if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS)
            {
                if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_ALREADY_EXISTS)
                {
                    throw new HttpSysException((int)statusCode, string.Format(Resources.Exception_PrefixAlreadyRegistered, uriPrefix));
                }
                else
                {
                    throw new HttpSysException((int)statusCode);
                }
            }
        }
示例#2
0
        internal void RegisterPrefix(string uriPrefix, int contextId)
        {
            _logger.LogDebug(LoggerEventIds.RegisteringPrefix, "Listening on prefix: {0}", uriPrefix);
            CheckDisposed();
            var statusCode = HttpApi.HttpAddUrlToUrlGroup(Id, uriPrefix, (ulong)contextId, 0);

            if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS)
            {
                if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_ALREADY_EXISTS)
                {
                    throw new HttpSysException((int)statusCode, Resources.FormatException_PrefixAlreadyRegistered(uriPrefix));
                }
                if (statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_ACCESS_DENIED)
                {
                    throw new HttpSysException((int)statusCode, Resources.FormatException_AccessDenied(uriPrefix, Environment.UserDomainName + @"\" + Environment.UserName));
                }
                throw new HttpSysException((int)statusCode);
            }
        }